Bug 3455 - System.Diagnostics.Debugger.Break() does not invoke the debugger.
Summary: System.Diagnostics.Debugger.Break() does not invoke the debugger.
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-02-14 16:30 UTC by Eric Beisecker
Modified: 2012-02-16 16:28 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Eric Beisecker 2012-02-14 16:30:05 UTC
Current Behavior: While debugging or running an Application that uses the System.Diagnostics.Debugger.Break() method, monodevelop does not enter debugging mode after executing the Debugger.Break() method. The application exists and the  message "Trace/BPT trap: 5" is outputted to the Console.

Expected Behavior: Deferring to MSDN for the expected behavior of Debugger.Break();
http://msdn.microsoft.com/en-us/library/system.diagnostics.debugger.break.aspx


Sample Code.

public static void Main (string[] args)
{ 
	Console.WriteLine("Before");
	System.Diagnostics.Debugger.Break();
	Console.WriteLine("After");
}

Versions: 
MonoDevelop 2.8.6.4
Mono 2.10.8
Comment 1 Mikayla Hutchinson [MSFT] 2012-02-14 17:56:18 UTC
Is this bug for running or debugging the app? They're very different things.

When the app is inside the soft debugger, then the JIT can insert an sdb breakpoint and it will work as expected. It was implemented last June along with Debugger.Log - maybe they never made it into 2.10?

As for breakpoints when running, the current behavior is the best you're likely to get any time soon. The JIT cannot switch mode at runtime from "run" to "debug", so it simply inserts a hard breakpoint, and it's up to the OS to cope with that.
Comment 2 Mikayla Hutchinson [MSFT] 2012-02-14 18:00:05 UTC
Yep, AFAICT Debugger.Break and Debugger.Log never got backported to 2.10.
Comment 3 Mikayla Hutchinson [MSFT] 2012-02-16 16:28:06 UTC
Closing since it was implemented long ago, it just hasn't made it to any release yet. If it should be backported, please reopen.