Page 1 of 1

Value cannot be null. Parameter name: key

Posted: Thu Jul 30, 2015 10:37 am
by Kamyar
I am using ASP.NET MVC 4.0 (System.Web.MVC v 4.0.0.1) and would like to use Stimulsoft (Ultimate version 2014.3.0.0) as our report engine.
Below is the code in my View:

Code: Select all

<body>
    <div>
        @Html.Stimulsoft().StiMvcViewer(
    "ReportViewer1",
    new StiMvcViewerOptions()
    {
        ActionGetReportSnapshot = "GetReportSnapshot",
        ActionViewerEvent = "ViewerEvent",
        Controller = "Print",
        Width = Unit.Percentage(100)
    })
    </div>
</body>
And below is my actions in PrintController:

Code: Select all

public ActionResult GetReportSnapshot()
{
    var report = new StiReport();
    report.Load(Server.MapPath("~/Content/Print/Ticket_Single.mrt"));
    report.Dictionary.Clear();
    report.RegData(GetReportData()); // GetReportData method return a dataset
    report.Dictionary.Synchronize();
    return StiMvcViewer.GetReportSnapshotResult(HttpContext, report);
}
public ActionResult ViewerEvent()
{
    return StiMvcViewer.ViewerEventResult(HttpContext);
}
I have also added an assembly binding for ASP.NET MVC v 4.0.0.1 in web.config:

Code: Select all

 <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="widgets;modules/temp" />
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
Code works fine and reports are displayed with no problem on my machine (Visual Studio 2013 Update 3).
But in a similar dev machine (same VS version installed + same Stimulsoft version installed) I get System.ArgumentNullException in the view. Below is the full stack trace.
I suspect there could be some conflicts between ASP.NET MVC 4.0.0.1 and this version of Stimulsoft (Works fine on my machine though!)
A similar problem has been discussed at http://stackoverflow.com/q/30272387/337294 with ASP.NET MVC 5.2.

Below is the full stack trace:

Server Error in '/' Application.
Value cannot be null.
Parameter name: key
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: key

Source Error:


Line 12: <body>
Line 13: <div>
Line 14: @Html.Stimulsoft().StiMvcViewer(
Line 15: "ReportViewer1",
Line 16: new StiMvcViewerOptions()


Source File: d:\TFS\Projects\VCC\WebApplication\Views\Print\Single.cshtml Line: 14

Stack Trace:


[ArgumentNullException: Value cannot be null.
Parameter name: key]
System.Collections.Generic.Dictionary`2.FindEntry(TKey key) +11064585
System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value) +12
Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.GetLiteralTraceData(LiteralControl literal, TraceData& data) +47
Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.GetTraceData(Object renderedObject) +225
Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.EndRendering(TextWriter writer, Object renderedObject) +35
System.Web.UI.RenderTraceListenerList.EndRendering(TextWriter writer, Object renderedObject) +58
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +142
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +10
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
Stimulsoft.Report.Mvc.StiMvcViewer.Render(HtmlTextWriter writer) +27
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
Stimulsoft.Report.Mvc.StiMvcHelper.StiMvcViewer(String ID, StiMvcViewerOptions options) +117
ASP._Page_Views_Print_Single_cshtml.Execute() in d:\TFS\Projects\VCC\WebApplication\Views\Print\Single.cshtml:14
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +103
System.Web.WebPages.StartPage.RunPage() +17
System.Web.WebPages.StartPage.ExecutePageHierarchy() +62
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +76
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +233
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +291
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +23
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +245
System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +22
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +176
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +75
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +99
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +50
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +39
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +31
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9690164
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34009

I'd appreciate if you guide me to solve/work around this problem.
P.S. Unfortunately, using flash based solution is not an option due to company policies.

Re: Value cannot be null. Parameter name: key

Posted: Fri Jul 31, 2015 1:39 pm
by HighAley
Hello.

Please, check the Web.config file. There should be used version of MVC.
If you use MVC 4 then it should be next:

Code: Select all

<runtime>
    <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.0" newVersion="4.0.0.1" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
If this is not help, please, send us a sample project and information of installed .Net Framework and MVC where you get the error.

Thank you.

Re: Value cannot be null. Parameter name: key

Posted: Sat Aug 01, 2015 6:47 am
by Kamyar
As I have mentioned in my first post, I have already added that bindingRedirect to my web.config and I am using Visual studio 2013 on Windows 8.1
I have converted one of your samples to MVC 4.0.0.1 and tested it on both machines. I still get the same error on one machine while it's working fine on the other.
I attached your sample project which I have updated to MVC 4.0.0.1.

Let me know if you needed further information.

Re: Value cannot be null. Parameter name: key

Posted: Tue Aug 04, 2015 8:34 am
by HighAley
Hello.

We have reproduced the issue on our 2014.3.0.0 build.
But there is no such error on our latest prerelease build.
Please, download it from our site and try.

Thank you.

Re: Value cannot be null. Parameter name: key

Posted: Sat Aug 08, 2015 9:49 pm
by mojiiiiiii7
I have same problem too on MVC 5 (System.Web.MVC v 5.2.3.0) and Stimulsoft (Ultimate version 2014.3.0.0)
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />

Re: Value cannot be null. Parameter name: key

Posted: Mon Aug 10, 2015 4:41 am
by Ivan
Hello.

We have reproduced the issue on release 2014.3.0.0.
But there is no such error on our latest prerelease build.
Please, download it from our site and try.

Thank you.

Re: Value cannot be null. Parameter name: key

Posted: Sat Aug 15, 2015 6:21 am
by Kamyar
We still face the same problem in Ultimate 2015.1 version.
I have tested the same project I have attached in my previous post with 2015.1 version.

Re: Value cannot be null. Parameter name: key

Posted: Sat Aug 15, 2015 6:25 am
by Jan
Hello,

Please use latest prerelease build 2015.1.16.

Thank you.

Re: Value cannot be null. Parameter name: key

Posted: Mon Jan 18, 2016 12:03 pm
by Yasser Mohammed ElSayed
I have the same issue issue using Stimulsoft Reports.Ultimate 2014.3 , MVC5 and visual studio 2013 and please notice the following:

1- i used the Stimulsoft sample and it is not working.
2- the only working sample was the FX viewer which need flash player to be installed on client browser (correct me if i'm wrong).

Thank You

Re: Value cannot be null. Parameter name: key

Posted: Tue Jan 19, 2016 8:04 am
by HighAley
Hello, Mohammed.

Could you specify what sample do you use? Do you get any error? Please, describe the issue more detailed.
All our samples are working.

Thank you.