StiMvcViewer method throw ArgumentNullException

Stimulsoft Reports.WEB discussion
Post Reply
LMS2001201
Posts: 9
Joined: Thu Oct 08, 2015 9:29 am

StiMvcViewer method throw ArgumentNullException

Post 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>
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: StiMvcViewer method throw ArgumentNullException

Post 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.
malcomjarr
Posts: 1
Joined: Wed Nov 18, 2020 6:34 am

Re: StiMvcViewer method throw ArgumentNullException

Post 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.
Lech Kulikowski
Posts: 6271
Joined: Tue Mar 20, 2018 5:34 am

Re: StiMvcViewer method throw ArgumentNullException

Post by Lech Kulikowski »

Hello,

Thank you for the information.
Post Reply