Appel

I have a c++ project that uses a .NET 1.1 assembly as a com object. It is loaded with CoCreateInstance. If I debug in native mode it looks like everything works okey, in managed mode the application crashes with no errors or anything, and in mixed mode Visual Studio crashes.

Something that looks somewhat suspisous to me is that it looks like .NET framework 2.0 assemblies and debug symbols are loaded. For example:

'MyApp.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\fusion.dll', No symbols loaded.
'MyApp.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\msvcr80.dll', PDB format is obsolete.
'MyApp.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\mscorwks.dll', No symbols loaded.

Am I doing something wrong or is it not possible to load .NET 1.1 assemblies as com objects with .NET 2.0 installed

/Johan



Re: Visual Studio Debugger VS IDE crashes when debugging in managed or mixed mode

Appel

Luckily uninstalling the VS 2005 beta allowed me to debug in managed and mixed mode using VS 2003 again. I really hope this wont be an issue when VS 2005 is released.



Re: Visual Studio Debugger VS IDE crashes when debugging in managed or mixed mode

Habib Heydarian MSFT

This is a known behavior in the CLR. When managed code is loaded in a native process, the latest version of the CLR is loaded, regardless of whether your app was built with .NET 1.1 or .NET 2.0. In this scenario, your app (native process) is loading your dll (managed component).
 
In this case, your app is loading CLR 2.0. However, the 2003 debugger can only handle CLR 1.1 & 1.0. So when the VS2003 debugger tries to talk to a 2.0 CLR, it blows up.

You can address this issue by creating a .config file for your application so that it will load .NET 1.1 instead of .NET 2.0.

HabibH.




Re: Visual Studio Debugger VS IDE crashes when debugging in managed or mixed mode

Appel

Okey, that explains it. Thank you.



Re: Visual Studio Debugger VS IDE crashes when debugging in managed or mixed mode

Greg Neilson

Hi, I believe I'm also running into the same issue here - after install of VS 2005, my VS 2003 .NET 1.1 VB.NET application (which is invoked from a VB6 exe via COM interop) will not debug in VS 2003. The VB6 exe launches, but as soon as it invokes the .NET code via interop the program drops out of the debugger back to the IDE.

What do I need to put in the .config file to ensure I get the correct version of the CLR loaded


Cheers
Greg




Re: Visual Studio Debugger VS IDE crashes when debugging in managed or mixed mode

Greg Neilson

If you have both VS 2003 and VS 2005 installed, if you want to debug any VS 2003 CLR 1.1 apps that are called via COM Interop from a non .NET executable from VS 2003, it seems you have to have a .config file to force the CLR. Otherwise it seems what happens is that when the interop layer kicks in, the subsystem automatically loads CLR 2.0, which VS 2003 can't cope with - it may crash or it may just shut the app down and drop back to the IDE! The .config file has to be in the same directory as the non .NET exe and has to be named the same way as the exe, e.g. processhost.exe.config!!


<configuration>
   <startup>
      <requiredRuntime version="v1.1.4322"/>
   </startup>
</configuration>





Re: Visual Studio Debugger VS IDE crashes when debugging in managed or mixed mode

Austin H

Guys -- This one has been bugging me for weeks; I THOUGHT I had been able to debug mixed mode programs since VS2005 install so I had ruled that out; I thought it was a recent thing. I tried the config file and it worked like a champ! Now I'll make one for the vb6.exe and maybe I can debug within both dev environments at once, like I used to be able to.

Thanks for the GREAT post.

Austin H






Re: Visual Studio Debugger VS IDE crashes when debugging in managed or mixed mode

Sumith

THANKS for the great post



Re: Visual Studio Debugger VS IDE crashes when debugging in managed or mixed mode

Automater

I have installed Visual Studio 2003 on a computer that has not had .NET 2.0 installed before. So there would be no conflict in CLR versions. However I still get crashes when trying to do mixed mode debugging. The same code works in Visual Studio 2005 on another computer and allows me to do mixed mode debugging.

Any ideas

Thanks