managed c++ and native c++ interop


J

Jim

Hello,

I am writing an application that relies heavily on interop between managed
c++ and native c++.

The main project is managed c++, but most of the classes themselves are
written in native c++ using the
"#pragma unmanaged" to prevent them from getting compiled into MSIL. A few
of the native classes do wrap
..NET framework components, and they use the gcroot<> template to hold
instances of the managed pointers.

The problem is debugging. Visual Studio is having a very hard time stepping
through my project. It constantly hangs and/or crashes. I have never had
problems like this before, and it seems to only be related to combining
managed c++ and native c++ classes in the same project.

Is anyone else out there having this problem? Can anyone from MSFT help me?
I'm at the point where I'm going to have to rip out all the managed code
from my project, and go back to pure native c++.

Thanks,

-Jim
 
Ad

Advertisements

G

Gary Chang

Hi Jim,
The problem is debugging. Visual Studio is having a very hard time stepping
through my project. It constantly hangs and/or crashes. I have never had
problems like this before, and it seems to only be related to combining
managed c++ and native c++ classes in the same project.
Which caused the hangs/crashes of your program's debugging process?

Does your program crash under release mode?

If it is the heavy work load of the debugging process causes your debugger
hang, it would be as expected; lots of the interop marshalling work across
the managed/unmanaged boundary will squeeze out the capability of the
debugger sometimes.


Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
J

Jim

Thanks for your quick response Gary,

My program works find in both release and debug mode, it is only when I'm
stepping through it in the debugger that the problems occour.

"lots of the interop marshalling work across the managed/unmanaged boundary
will squeeze out the capability of the debugger sometimes"

I am running on a 3Ghz machine with a Gig of Ram. I understand that the
interop marshalling can be expensive, but I would think my machine could
handle it. When you say that lots of marshalling will squeeze out the
capability of the debugger, what exactly do you mean by "lots"? Are there
any papers or technical articles about this? It is very important for me to
be able to step through my code in the debugger, and I am very interested in
any known limitations of the debugger.

Thanks again!

-Jim
 
R

Ronald Laeremans [MSFT]

Hi Jim,

There are know bugs in the debugger interop stepping code. The only thing in
general you can do it to try and avoid stepping over these points as much as
possible (e.g. by setting breakpoints rather than stepping).

Ronald Laeremans
Visual C++ team
 
Ad

Advertisements

G

Gary Chang

Hi Jim,

Does Ronald's reply answer your question?
If you have more concerns on this topic, please feel free to reply this
message.


Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top