Share via

C++/CLI breakpoints not stopping

Rudolf Meier 291 Reputation points
2024-05-14T00:10:57.0833333+00:00

I try to debug an extension for Visual Studio (2019/2022) that I wrote in C++/CLI. Now... the extension itself works. The only problem is, that I cannot jump into the code while it is executing. The breakpoints never stop. But, when I create a C# extension and derive the package from my C++/CLI package and simply override 1 function (with a function that only calls its base) and then run this extension... suddendly the breakpoints in C++/CLI start to work.

The question now is... why? (I try to do this with VS2019). Is ... I don't know...the debugger different? Is something done/modified when I load the C++/CLI code not directly but via dependency of the C# assembly? ... or is the debugging information ... modified? merged? ... why could this happen?

Developer technologies | C++
Developer technologies | C++

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.

Developer technologies | .NET | .NET CLI

Answer accepted by question author

hondaman-3591 81 Reputation points
2024-05-19T01:57:56.8266667+00:00

As far as I am concerned, it's no code triggers the function, rather than no breakpoint hit.

I added the constructor and comment C# code //InitializeAsync

BreakpointDemonstratorPackage()
{
Debug::WriteLine("XXX");//break point
}

Then reach the constructor's breakpoint and output.

Also, I need to add a command item file to test the extension.

Even if the inheritance

 VSIXWrapperPackage:AsyncPackage / * BreakpointDemonstrator BreakpointDemonstratorPackage * /

Without InitializeAsync, command1.cs ShowMessageBox will not trigger.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.