Bug 20039 - Function returns random double when running step-by-step
Summary: Function returns random double when running step-by-step
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Debugger ()
Version: 4.0.12
Hardware: PC Linux
: High normal
Target Milestone: master
Assignee: Jeffrey Stedfast
Depends on:
Reported: 2014-05-26 06:41 UTC by Derp
Modified: 2014-06-02 06:59 UTC (History)
2 users (show)

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

Example code posted in description (379 bytes, application/octet-stream)
2014-05-26 06:41 UTC, Derp

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 Developer Community or GitHub 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 Derp 2014-05-26 06:41:02 UTC
Created attachment 6879 [details]
Example code posted in description

Description of Problem:
A function that returns a double value will return a non-correct value if the program is executed step-by-step.

Steps to reproduce the problem:

using System;
namespace DoubleBug{
	class MainClass{
		public static void Main(string[] args){
			Doubly doub = new Doubly(12345.0);
			double e = doub.getValue();
			Console.WriteLine("main() = " + e);

	class Doubly{
		double d;
		public Doubly(double val){
			d = val;

		public double getValue(){
			Console.WriteLine ("getValue() = " + d);
			return d;

Compile, set breakpoint to "getValue()" and step through the lines.

Actual Results:
getValue() = 12345
main() = 2,25 (<= sometimes "6", "10,5" ...)

Expected Results:
getValue() = 12345
main() = 12345

How often does this happen? 
Every time I run this piece of code. It DOES NOT happen when the program runs on its own (no breakpoints and no step-by-step execution).

Additional Information:
=== MonoDevelop ===

Version 4.0.12
	Mono 3.2.8 (Debian 3.2.8+dfsg-4ubuntu1) (64-bit)
	GTK 2.24.23
	GTK# (

=== Build Information ===

Git revision:
Build date: 2014-01-08 14:59:33+0000
Comment 1 Jeffrey Stedfast 2014-05-28 10:45:45 UTC
Try upgrading your MonoDevelop and Mono runtime.

Works fine for me with the latest versions.

This is what I get:

getValue() = 12345
main() = 12345
Comment 2 Derp 2014-06-02 06:59:52 UTC
Seems to be fixed in:

=== MonoDevelop ===

Version 5.1
Installation UUID: 1891a8ec-965e-42e9-9e6a-0f685eb0fecd
	Mono 3.2.8 (Debian 3.2.8+dfsg-4ubuntu1) (64-bit)
	GTK+ 2.24.23 (Bluebird theme)

=== Build Information ===


...build from git-sources 1h ago.