UpTheCreek
UpTheCreek

Reputation: 32391

Stepping through ASP.NET MVC 2 source

I've been trying to set up the ASP.NET MVC 2 RTM Source for use with my app, so I can step through things like model binding when debugging. However, I haven't been able to get it to work - I'm getting errors like:

The type 'System.Web.Mvc.Controller' is defined in an assembly that is not referenced. 
You must add a reference to assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'.

The type 'System.Web.Mvc.Async.AsyncControllerActionInvoker' is defined in an assembly that is not referenced. 
You must add a reference to assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=31bf3856ad364e35'.

Etc...

I followed the steps in Steve Sanderson's howto (for MVC1), but perhaps there are different steps to get it to work in MVC2?

Steps I have taken so far:

So, questions:

Thank you!

UPDATE: In response to Syd's questions, here's some extra info:

1) Current assemblies node from web.config:

<compilation debug="true">
    <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    </assemblies>
</compilation>

2) Yes, I am using MVC Futures, but have that project built in my solution too, and have referenced it to use the System.Web.Mvc in the solution.

3) I am using a few non-standard references. Rather that a screenshot I'll list them here:

Autofac
Autofac.Integration.Web
Autofac.Integration.Web.Mvc
Elmah
FluentValidation
FluentValidation.Mvc
log4net
MvcContrib
MySql.Data
NHibernate
MvcFutures

Upvotes: 1

Views: 593

Answers (2)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038930

You don't need to download the source code or remove references from the GAC. Just follow the steps described in this blog post.

  • Uncheck: Enable Just My Code (Managed only)
  • Check: Enable source server support
  • Add symbols server: In VS2010 you only need to check the Microsoft Symbols Servers, no need to enter url, in VS2008 you need to enter the url

Create a new ASP.NET MVC application, put a breakpoint in your controller action and when the breakpoint gets hit, load the symbols for the System.Web.Mvc assembly from the call stack and once the symbols are loaded you will be able to step through the source code (after accepting the terms and conditions).

Upvotes: 3

Syd
Syd

Reputation: 1546

Instead of commenting out the <assemblies><add assembly> lines, you should set the PublicKeyToken=null instead.

Upvotes: 1

Related Questions