AccessViolationException after upgrading MVC3 project to VS2012

I developed the MVC3 website using VS2010, which works great. I recently upgraded my application environment to the RTM version of VS2012. Now I can not start the website in the debugger without crashing the development web server.

WebDev.WebServer40.exe stops working

I see one of two similar stack traces in VS2012:

First, an AccessViolationException :

 mscorlib.dll!System.StringComparer.GetHashCode(object obj) + 0xc bytes mscorlib.dll!System.Collections.Hashtable.GetHash(object key) + 0x10 bytes mscorlib.dll!System.Collections.Hashtable.InitHash(object key, int hashsize, out uint seed, out uint incr) + 0xf bytes mscorlib.dll!System.Collections.Hashtable.Remove(object key) + 0x38 bytes System.dll!System.Collections.Specialized.NameObjectCollectionBase.BaseRemove(string name) + 0x2e bytes System.Web.dll!System.Web.SessionState.SessionStateItemCollection.Remove(string name) + 0x56 bytes System.Web.dll!System.Web.SessionState.HttpSessionStateContainer.Remove(string name) + 0xc bytes System.Web.dll!System.Web.HttpSessionStateWrapper.Remove(string name) + 0xf bytes Dive7.Site.dll!Dive7.Site.D7WebViewPage<object>.IsAdmin.get() Line 56 + 0x19 bytes C# 

Secondly, a NullReferenceException :

 mscorlib.dll!System.StringComparer.GetHashCode(object obj) + 0x33 bytes mscorlib.dll!System.Collections.Hashtable.GetHash(object key) + 0x10 bytes mscorlib.dll!System.Collections.Hashtable.InitHash(object key, int hashsize, out uint seed, out uint incr) + 0xf bytes mscorlib.dll!System.Collections.Hashtable.Remove(object key) + 0x38 bytes System.dll!System.Collections.Specialized.NameObjectCollectionBase.BaseRemove(string name) + 0x2e bytes System.Web.dll!System.Web.SessionState.SessionStateItemCollection.Remove(string name) + 0x56 bytes System.Web.dll!System.Web.SessionState.HttpSessionStateContainer.Remove(string name) + 0xc bytes System.Web.dll!System.Web.HttpSessionStateWrapper.Remove(string name) + 0xf bytes Dive7.Site.dll!Dive7.Site.D7WebViewPage<object>.IsAdmin.get() Line 56 + 0x19 bytes C# 

The exact one that appears seems random.

As far as I know, all I did was install VS2012, reboot, and then open the VS2010 solution in the new VS version, see that the update was successful, and press F5 .

I have no ideas. Can anyone suggest what might happen?

+2
visual-studio asp.net-mvc visual-studio-2012 asp.net-mvc-3
source share
2 answers

Please read the "Installing ASP.NET MVC 4 Breaks ASP.NET MVC 3 RTM Applications" section from http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253815 . Follow the “Required Updates” settings and let me know if this error is still playing.

+2
source share

As Anand pointed out, you have to make some manual changes to the MVC3 application when you open it in VS2012, since installing VS2012 also installs MVC4. These changes allow you to perform side by side:

In Web.config :

 <appSettings> <add key="webpages:Version" value="1.0.0.0"/> <add key="ClientValidationEnabled" value="true"/> <add key="UnobtrusiveJavaScriptEnabled" value="true"/> </appSettings> 

Then edit the MVC project .csproj . Replace these lines:

 <Reference Include="System.Web.WebPages"/> <Reference Include="System.Web.Helpers" /> 

(they may look like this :)

 <Reference Include="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\..\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.dll</HintPath> </Reference> <Reference Include="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> </Reference> 

With these lines:

 <Reference Include="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL "/> <Reference Include="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> 

Adapted from MVC4 Release Notes .

0
source share

All Articles