Debugging ASP.NET MVC

View: New views
6 Messages — Rating Filter:   Alert me  

Debugging ASP.NET MVC

by Mark Needham-2 :: Rate this Message:

| View Threaded | Show Only this Message

Hey,

Does anyone know how to hook up the System.Web.Mvc dll so that we can step
through the code and debug it?

We've tried referencing a locally built copy of the dll with debug symbols
etc in the project but when we run it we get a conflict with the dll 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.NETFiles\root\8553427a\c1d1b9c6\assembly\dl3\898a195a\60680eb9_3349c901\System.Web.Mvc.DLL'
and
'c:\WINDOWS\assembly\GAC_MSIL\System.Web.Mvc\1.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll'

We tried to remove the dll from the GAC but it says it has other
dependencies which don't allow uninstallation.

Any ideas how we can debug this?

Cheers,
Mark

Re: Debugging ASP.NET MVC

by simone_b :: Rate this Message:

| View Threaded | Show Only this Message

Have you tried uninstalling ASP.NET MVC?

On Tue, Nov 18, 2008 at 7:23 AM, Mark Needham <m.h.needham@...>wrote:

>   Hey,
>
> Does anyone know how to hook up the System.Web.Mvc dll so that we can step
> through the code and debug it?
>
> We've tried referencing a locally built copy of the dll with debug symbols
> etc in the project but when we run it we get a conflict with the dll 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.NETFiles\root\8553427a\c1d1b9c6\assembly\dl3\898a195a\60680eb9_3349c901\System.Web.Mvc.DLL'
> and
> 'c:\WINDOWS\assembly\GAC_MSIL\System.Web.Mvc\1.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll'
>
> We tried to remove the dll from the GAC but it says it has other
> dependencies which don't allow uninstallation.
>
> Any ideas how we can debug this?
>
> Cheers,
> Mark
>  
>

Re: Debugging ASP.NET MVC

by Dylan Beattie :: Rate this Message:

| View Threaded | Show Only this Message

It's possible to remove System.Web.Mvc from the GAC by hacking the registry to remove the dependencies - I've had to do this to run Beta 1 and Preview 3 side-by-side, but the same technique should work for you:

http://dylanbeattie.blogspot.com/2008/11/working-on-aspnet-mvc-beta-and-preview.html

Usual caveats about registry-hacking apply, and remember to make sure you're copying the DLLs locally when you build/deploy your project, but I haven't had any problems since I'd say it all seems to be working...

Dylan


  ----- Original Message -----
  From: Mark Needham
  To: altdotnet@...
  Sent: Tuesday, November 18, 2008 6:23 AM
  Subject: [altdotnet] Debugging ASP.NET MVC


  Hey,

  Does anyone know how to hook up the System.Web.Mvc dll so that we can step through the code and debug it?

  We've tried referencing a locally built copy of the dll with debug symbols etc in the project but when we run it we get a conflict with the dll 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\1.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll'

  We tried to remove the dll from the GAC but it says it has other dependencies which don't allow uninstallation.

  Any ideas how we can debug this?

  Cheers,
  Mark


   

Re: Debugging ASP.NET MVC

by Derik Whittaker :: Rate this Message:

| View Threaded | Show Only this Message

I am not sure why you have to 'hack' this to run.  All versions of the
MVC are bin deployable and should run side by side.

--- In altdotnet@..., "Dylan Beattie" <dylan@...> wrote:
>
> It's possible to remove System.Web.Mvc from the GAC by hacking the
registry to remove the dependencies - I've had to do this to run Beta
1 and Preview 3 side-by-side, but the same technique should work for you:
>
>
http://dylanbeattie.blogspot.com/2008/11/working-on-aspnet-mvc-beta-and-preview.html
>
> Usual caveats about registry-hacking apply, and remember to make
sure you're copying the DLLs locally when you build/deploy your
project, but I haven't had any problems since I'd say it all seems to
be working...

>
> Dylan
>
>
>   ----- Original Message -----
>   From: Mark Needham
>   To: altdotnet@...
>   Sent: Tuesday, November 18, 2008 6:23 AM
>   Subject: [altdotnet] Debugging ASP.NET MVC
>
>
>   Hey,
>
>   Does anyone know how to hook up the System.Web.Mvc dll so that we
can step through the code and debug it?
>
>   We've tried referencing a locally built copy of the dll with debug
symbols etc in the project but when we run it we get a conflict with
the dll 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\1.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll'
>
>   We tried to remove the dll from the GAC but it says it has other
dependencies which don't allow uninstallation.
>
>   Any ideas how we can debug this?
>
>   Cheers,
>   Mark
>



Re: Re: Debugging ASP.NET MVC

by Brad Wilson-2 :: Rate this Message:

| View Threaded | Show Only this Message

It sounds like the project has references to both the GAC version and the
bin version, and since the bin version doesn't have the same public key,
it's not considered to be the same thing. The GAC version is probably being
referenced in the Web.config file.

On Tue, Nov 18, 2008 at 7:42 AM, Derik Whittaker <graudowd@...> wrote:

> I am not sure why you have to 'hack' this to run.  All versions of the
> MVC are bin deployable and should run side by side.
>
> --- In altdotnet@..., "Dylan Beattie" <dylan@...> wrote:
> >
> > It's possible to remove System.Web.Mvc from the GAC by hacking the
> registry to remove the dependencies - I've had to do this to run Beta
> 1 and Preview 3 side-by-side, but the same technique should work for you:
> >
> >
>
> http://dylanbeattie.blogspot.com/2008/11/working-on-aspnet-mvc-beta-and-preview.html
> >
> > Usual caveats about registry-hacking apply, and remember to make
> sure you're copying the DLLs locally when you build/deploy your
> project, but I haven't had any problems since I'd say it all seems to
> be working...
> >
> > Dylan
> >
> >
> >   ----- Original Message -----
> >   From: Mark Needham
> >   To: altdotnet@...
> >   Sent: Tuesday, November 18, 2008 6:23 AM
> >   Subject: [altdotnet] Debugging ASP.NET MVC
> >
> >
> >   Hey,
> >
> >   Does anyone know how to hook up the System.Web.Mvc dll so that we
> can step through the code and debug it?
> >
> >   We've tried referencing a locally built copy of the dll with debug
> symbols etc in the project but when we run it we get a conflict with
> the dll 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\1.0.0.0__31bf3856ad364e35\System.Web.Mvc.dll'
> >
> >   We tried to remove the dll from the GAC but it says it has other
> dependencies which don't allow uninstallation.
> >
> >   Any ideas how we can debug this?
> >
> >   Cheers,
> >   Mark
> >
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>


--
http://bradwilson.typepad.com/
http://social.zune.net/member/Agilist
http://www.flickr.com/photos/dotnetguy/

Re: Re: Debugging ASP.NET MVC

by Dylan Beattie :: Rate this Message:

| View Threaded | Show Only this Message

> It sounds like the project has references to both the GAC version and
>  the bin version, and since the bin version doesn't have the same public
> key, it's not considered to be the same thing. The GAC version is
> probably being referenced in the Web.config file.

If you're building your /bin assembly from the unmodified beta source, the /bin version does have the same public key as the GAC version. As far as I could ascertain, the GAC reference is overriding actually override the /bin reference regardless of Web.config settings, because the GAC & /bin versions have exactly the same assembly version and public key - when it comes to resolving the assembly reference at runtime, the CLR never even checks the /bin folder, because it's already found a matching assembly in the GAC. Changing references in web.config didn't appear to have any effect on which version of the assembly was used.

An alternative to hacking the registry would be compiling System.Web.Mvc yourself from source, changing the assembly version in the project properties, and then referencing that specific assembly version (System.Web.Mvc 1.1.1.1 or whatever) in your Web project.

I believe - but I may be wrong - that this situation has arisen because the MVC team decided not to increment the assembly version between preview and beta releases; the advantage here is that you don't need to modify your app references when upgrading preview releases, but it does mean there's no way the CLR can tell the various preview versions apart.

Dylan