Tomas
Tomas

Reputation: 125

How can you skip over user-defined breakpoints in .NET?

I have an assembly compiled in debug mode, with DEBUG defined. If I execute this directly, from the command line, a window will pop up saying a user-defined breakpoint was encountered. How can I ignore these or have them close automatically without stopping the program?

I noticed that when I run a whole batch of programs like this from msbuild, with CallTargets and RunEachTargetSeparately="true", the dialogs pop up, but then automatically go away. So I know there's a way to do this, but I haven't been able to figure it out.

I'm looking for a way to do this that doesn't require changing the assembly or recompiling.

Upvotes: 0

Views: 99

Answers (1)

Element
Element

Reputation: 4051

If you have to run in dbg and you have access to the source code you can add checks to see if a debugger is attached before breaking

e.g.

if (Debugger.IsAttached())
           Debugger.Break()

Upvotes: 1

Related Questions