As we already got debug assembly and pdb file, it it time to create a test project that would be a sandbox for all experiments. This would be classic MVC application, but we going to substitute release version of MVC framework with our locally built version, which allows us easily debug it.
Let’s create new project. It would be MVC 3 Application:
On a second step just select “Empty” in “Select template” dialog. “Razor” would be for view engine.
web.config of a new project and comment out
System.Web.WebPages assemblies. By doing that we saying: “those 2 assemblies are no longer a part of compilation of our application”.
UPDATE: If you do just that, later you will get an exception from Razor assemblies, about wrong type cast. To avoid that, it is even better to remove all assemblies in this section, plus Find/Replace PublicKeyToken=31bf3856ad364e35 to PublicKeyToken=null. That would do not make application to search GAC for missing assemblies and load locally built ones.
Now, remove existing references for
System.Web.WebPages and put locally built ones instead. Right click on references project section and browse to the Debug folder of mvc3-rtm build directory. Try to build application now, it should be build without any issues.
Further steps are pretty simple, just add a test controller -
Index action. Add just a simple view for that.
Place a breakpoint into action method and press F5 to start debugger. Now you we’ve got a full stack trace that allows to see every aspect of MVC world.
The setup is easy and allows to jump in very quick. If you got any issues with that, please let me know.
Next I will hack the entry point of MVC application called
MvcHandler and understand how it works.
Please stay tuned.