Debugging ASP.NET MVC source code
We’ve been doing some work with the ASP.NET MVC framework this week and one of the things we wanted to be able to do is to debug through the source code to see how it works.
Our initial idea was to bin deploy the ASP.NET MVC assemblies with the corresponding pdbs. Unfortunately this didn’t work and we got a conflict with the assemblies deployed in the GAC:
Compiler Error Message: CS0433: The type 'System.Web.Mvc.FormMethod' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\8553427a\c1d1b9c6\assembly\dl3\898a195a\60680eb9_3349c901\System.Web.Mvc.DLL' and 'c:\WINDOWS\assembly\GAC_MSIL\System.Web.Mvc\18.104.22.168__31bf3856ad364e35\System.Web.Mvc.dll'
We attempted to uninstall the System.Web.Mvc assembly from the GAC but were unable to do so because it has other dependencies.
The next idea was to uninstall ASP.NET MVC using the MSI uninstaller. This worked in terms of getting rid of the assembly from the GAC but it meant that we no longer had support for ASP.NET MVC in Visual Studio.
Luckily Troy pointed out James Kovac’s blog post about debugging the .NET framework source and we were able to debug the ASP.NET MVC code by hooking up the pdbs that come with the source code download.
Some other approaches were pointed out on the ALT.NET mailing list although the above is what worked for us.