Starr Duskk
asked on
Value cannot be null. Parameter name: key
When I upgraded to Visual Studio 2015 from 2012, on one of my pages I get this error when running my project locally. I have stepped through the code and it isn't in any of my code. It errors in one of the Microsoft compiled libraries, but I can't tell where. I load the same project back into 2012 and it works fine. It only occurs in 2015. See more info below the error. You'll notice nothing is in the message below to indicate a line of my code, which I've seen in other forums, it usually tells where in the person's code the problem has arisen.
I had read on a forum to add this to the app settings in the web.config
<add key="PageInspector:ServerC odeMapping Support" value="Disabled" />
That DOES stop the error from occurring. But is that a good thing to have that disabled? And why the Band-Aid? I'd like to know a fix.
Meanwhile, someone said when they added that to their web.config it caused their project to do a complete recompile, so that was his problem. He removed that line of code and it worked after a complete recompile.
I tried the same thing and it did not work. I did a Clean on every project in my solution. I did a rebuild on the solution. Same problem. It only fixes it if that setting has PageInspector disabled.
When I recompiled, I also got this warning. I don't know if it is related:
someone said their issue turned out to be:
I don't know what they meant by that. That it caused the problem or removed the problem. But I didn't have it, so I added it and that did not fix my problem.
Any suggestions? Should I just leave the PageInspector off? What other problems might that cause?
thanks!
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:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: key]
System.Collections.Generic.Dictionary`2.FindEntry(TKey key) +12206745
System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value) +16
Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.GetLiteralTraceData(LiteralControl literal, TraceData& data) +47
Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.GetTraceData(Object renderedObject) +259
Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.EndRendering(TextWriter writer, Object renderedObject) +35
System.Web.UI.RenderTraceListenerList.EndRendering(TextWriter writer, Object renderedObject) +66
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +170
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) +13
System.Web.UI.Control.Render(HtmlTextWriter writer) +12
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66
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) +13
System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +12
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66
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) +13
System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +12
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66
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) +13
System.Web.UI.Control.Render(HtmlTextWriter writer) +12
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66
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) +13
System.Web.UI.Control.Render(HtmlTextWriter writer) +12
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66
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.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +106
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +53
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +13
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66
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) +13
System.Web.UI.Control.Render(HtmlTextWriter writer) +12
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66
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) +13
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1303
________________________________________
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.81.0
I had read on a forum to add this to the app settings in the web.config
<add key="PageInspector:ServerC
That DOES stop the error from occurring. But is that a good thing to have that disabled? And why the Band-Aid? I'd like to know a fix.
Meanwhile, someone said when they added that to their web.config it caused their project to do a complete recompile, so that was his problem. He removed that line of code and it worked after a complete recompile.
I tried the same thing and it did not work. I did a Clean on every project in my solution. I did a rebuild on the solution. Same problem. It only fixes it if that setting has PageInspector disabled.
When I recompiled, I also got this warning. I don't know if it is related:
7>(0,0): warning CS1685: The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll'
7>(0,0): warning CS1685: The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll'
7>Validation Complete
someone said their issue turned out to be:
optimizeCompilations="true"
I don't know what they meant by that. That it caused the problem or removed the problem. But I didn't have it, so I added it and that did not fix my problem.
Any suggestions? Should I just leave the PageInspector off? What other problems might that cause?
thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I did check the web.config file in that location for both the framework and framework64. Both have this:
Nothing specifically enabling it. But maybe the post I saw for 2013 doesn't apply to 2015 and it is enabled by default now. Certainly wasn't an issue with my 2012.
I'm afraid to mess with these files so I'll just disable the PageInspector. I just wanted to make sure I wasn't breaking anything.
I did test it remotely without the PageInspector disabled and publishing my code from 2015 to the remote site and there were no issues at the spot where it always errors. So it does seem to be a local thing only.
Thanks!
<remove assembly="Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add assembly="Microsoft.VisualStudio.Web.PageInspector.Loader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Nothing specifically enabling it. But maybe the post I saw for 2013 doesn't apply to 2015 and it is enabled by default now. Certainly wasn't an issue with my 2012.
I'm afraid to mess with these files so I'll just disable the PageInspector. I just wanted to make sure I wasn't breaking anything.
I did test it remotely without the PageInspector disabled and publishing my code from 2015 to the remote site and there were no issues at the spot where it always errors. So it does seem to be a local thing only.
Thanks!
ASKER
https://msdn.microsoft.com/en-us/library/hh975440%28v=vs.120%29.aspx?f=255&MSPPError=-2147217396
In VS2013, it says the PageInspector:ServerCodeMa
In an effort to find out more about the PageInspector, I read this blog:
http://bchavez.bitarmory.com/archive/2012/12/28/rip-page-inspector-out-of-your-web-site-projects-now.aspx
It says to rip it out of your project and why and how.
Basically, Microsoft says the default is disabled, yet it is not.
Strange.