Cadair Idris
Cadair Idris

Reputation: 1

Managed class libraries cant be debugged when a native app is launched

In visual studio 2005 we could build managed class libraries and debug them by setting the start external program path to our native application. The native app would create and run the managed code through com.

In visual studio 2012 the same process does not seem to work. When the native app is launched nothing appears to be loaded in the modules window.

Detaching the debugger and re-attaching to the running process causes the modules to be loaded and the managed class libraries can now be debugged.

How can i get the modules loaded automatically?

Upvotes: 0

Views: 79

Answers (1)

thomasmichaelwallace
thomasmichaelwallace

Reputation: 8474

This happens when a native application launches a version of the .NET Framework that uses a different CLR to that of the tool version of Visual Studio.

For example, if your native application uses .NET 2.0 and you're using VS2012 then you need to manually point the debugger towards the correct version of the framework.

You can do this by adding a [native application].exe.config file that specifies the CLR version, for example (to .NET 2.0 - 3.5, CLR 2.0):

<?xml version ="1.0"?>
<configuration>
    <startup>
        <!-- Required for automatic Module debugging. -->
        <supportedRuntime version="v2.0.50727" />
    </startup>
</configuration>

This is a known issue, if you want to find out more:

http://blogs.msdn.com/b/andrehal/archive/2010/04/29/can-t-hit-breakpoints-in-a-plug-in-or-can-t-debug-net-2-0-3-0-3-5-from-a-mixed-mode-exe-project-with-visual-studio-2010.aspx

Upvotes: 1

Related Questions