Breakpoints and Visual Studio 2005

N

Norman Diamond

One Visual Studio 2005 solution contains a C# project and C++ ATL DLL
project. The DLL compiles fine, gets registered automatically, gets
referenced correctly when the C# program compiles, and gets called correctly
during execution. So far, so good.

During execution of the DLL, a call to the ATL/MFC shared library method
CImage::Create returns FALSE.[*] So I tried to set a breakpoint before the
call.

When not executing, Visual Studio displays a brown dot saying that the
breakpoint is valid. When executing, Visual Studio displays a mostly
transparent dot with an exclamation mark saying that the breakpoint is not
valid. I can right-click the dot and set an option for the "place" of the
breakpoint, but it doesn't matter. The breakpoint never gets hit.

When I add and remove calls to the Win32 API MessageBox, they get executed
correctly. So the DLL is getting recompiled properly and executed properly,
only the breaker is broken.

Does anyone know how to get breakpoints working?

[* I don't need help with this failure at this moment. I only need help
with getting breakpoints working.]
 
S

SvenC

Hi Norman,
One Visual Studio 2005 solution contains a C# project and C++ ATL DLL
project. The DLL compiles fine, gets registered automatically, gets
referenced correctly when the C# program compiles, and gets called
correctly during execution. So far, so good.
...
When not executing, Visual Studio displays a brown dot saying that the
breakpoint is valid. When executing, Visual Studio displays a mostly
transparent dot with an exclamation mark saying that the breakpoint is not
valid. I can right-click the dot and set an option for the "place" of the
breakpoint, but it doesn't matter. The breakpoint never gets hit.

Two things:
1) are you using debug builds?
2) did you enable mixed debugging for managed und unmanaged code?
Project->Properties->Debug "Enable unmanaged code debugging"
 
N

Norman Diamond

SvenC said:
Hi Norman,


Two things:
1) are you using debug builds?

Yes of course.
2) did you enable mixed debugging for managed und unmanaged code?
Project->Properties->Debug "Enable unmanaged code debugging"

That was almost enough information to find it. Thank you. I know not to
shoot the messenger for this incredibly bad design, and I thank you for
informing me.

The solution has two projects in it. Visual Studio's options, Tools -
Options - Debug, don't do anything to prevent debugging (I suppose they
could be set to prevent debugging but I didn't do so). In the DLL's
properties, the debug options don't do anything to prevent debugging. You
described an option which is available in the C# project's properties. In
order to debug project #1, it's necessary to right-click project #2 and set
project #2's properties to enable debugging of project #1. What an easily
discoverable (not) way to stop breakpoints from breaking in project #1.

Coming next: To shut down your computer, don't click Start on your
computer, but click Start on your neighbour's computer.
 

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