Bug 3743 - Static method not returning properly
Summary: Static method not returning properly
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
Depends on:
Reported: 2012-03-03 17:24 UTC by danmiser
Modified: 2017-07-11 22:48 UTC (History)
6 users (show)

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:

Description danmiser 2012-03-03 17:24:51 UTC
In the MonoTouch ReachabilitySample, change the beginning of InternetConnectionStatus method to this (ignore, for the moment, whether or not this is the correct thing to do). Essentially, I'm changing the if statement to be a not.

NetworkReachabilityFlags flags;
NetworkStatus status = NetworkStatus.NotReachable;
bool defaultNetworkAvailable = IsNetworkAvaialable (out flags);
if (!defaultNetworkAvailable){

Set a breakpoint at the beginning of this method.

Debug the application and step through this method.

//Expected: When return NetworkStatus.NotReachable gets executed, the method should return immediately.
//Actual: The debugger executes the return statement and then takes you to the end of the method where the return NetworkStatus.ReachableViaWiFiNetwork line gets executed, and this value is the value that returns from the method.
Comment 1 Sebastien Pouliot 2012-03-05 08:59:03 UTC
Does the application behave correctly ?

The debugger uses the (sequence points) inside the .mdb files. The files are mapped to IL instructions and, in some cases [1], it might seem to jump a bit randomly (since you don't see the IL but the source code). However the execution should work normally.

[1] using (var x = new disposableobject ()) is a common case since the compiler will create a Dispose call (that occurs later in the IL but has the same source code, i.e. line number, origin).

-> MonoDevelop | Debugger
Comment 2 Jeffrey Stedfast 2012-03-05 10:27:18 UTC
This actually looks more like a runtime or compiler issue.

In any event, the actual value returned by the method is the correct value, it just makes 1 last stop at the last line of the method even tho it's already hit another return statement.
Comment 3 Rodrigo Kumpera 2013-09-09 12:03:57 UTC