Page 1 of 1

StiMvcViewer method throw ArgumentNullException

Posted: Fri Oct 09, 2015 1:58 am
by LMS2001201
I`m new here and start to learn about Stimulsoft.When I running a demo project the StiMvcViewer method throw ArgumentNullException.
I wish I can get the solution here ,thanks!
My project is MVC4,and I reference the 3 DLL files Stimulsoft.Base,Stimulsoft.Report,Stimulsoft.Report.Mvc.All the 3 DLL`s version is 2014.3.0.0.
My code:

Code: Select all

     @Html.Stimulsoft().StiMvcViewer(new StiMvcViewerOptions()
       {
           Theme = StiTheme.Office2010,
           ActionGetReportSnapshot = "GetReportSnapshot",
           ActionViewerEvent = "ViewerEvent",
           ActionPrintReport = "PrintReport",
           ActionExportReport = "ExportReport",
           ActionInteraction = "Interaction"
       })
My Web.config :

Code: Select all

<pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages"/>

        <add namespace="Stimulsoft.Report.Mvc" />
      </namespaces>
    </pages>

Code: Select all

  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>

Re: StiMvcViewer method throw ArgumentNullException

Posted: Fri Oct 09, 2015 5:51 am
by HighAley
Hello.

Our assemblies are compiled using MVC 3.0.0.1. So you should make next changes in the web.config file:

Code: Select all

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.1" newVersion="4.0.0.0" />
  </dependentAssembly>
</assemblyBinding>
Thank you.

Re: StiMvcViewer method throw ArgumentNullException

Posted: Wed Nov 18, 2020 6:37 am
by malcomjarr
The exception that is thrown when a C# null reference is passed to a method that does not accept it as a valid argument. An ArgumentNullException exception is thrown at run time in the following two major circumstances:
  • An uninstantiated object is passed to a method. To prevent the error, instantiate the object.
  • An object returned from a method call is then passed as an argument to a second method, but the value of the original returned object is null. To prevent the error, check for a return value that is null and call the second method only if the return value is not null.

Re: StiMvcViewer method throw ArgumentNullException

Posted: Wed Nov 18, 2020 8:20 am
by Lech Kulikowski
Hello,

Thank you for the information.