Bug 21673 - Concurrency issue in Double.ToString("R", CultureInfo.InvariantCulture)
Summary: Concurrency issue in Double.ToString("R", CultureInfo.InvariantCulture)
Status: RESOLVED DUPLICATE of bug 18599
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: 3.4.0
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-07-29 17:02 UTC by Gabriel Acevedo
Modified: 2014-07-29 23:51 UTC (History)
3 users (show)

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

Test case (684 bytes, application/octet-stream)
2014-07-29 17:02 UTC, Gabriel Acevedo

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 Gabriel Acevedo 2014-07-29 17:02:07 UTC
Created attachment 7523 [details]
Test case

Unexpected values and crashes when using Double.ToString("R", CultureInfo.InvariantCulture) in a multithreaded program. I was unable to reproduce the issue on Microsoft .NET, or Mono for Mac (x86, amd64), or using a single thread program. Please note that -as you would expect- the program output below varies from execution to execution (there's always an exception, though). I'm afraid I don't have more insight on why this occurs. Attaching a test case. Compile using mcs test.cs.

Operating system:
Linux 3.10.35-43.137.amzn1.x86_64

Mono version:
Mono JIT compiler version 3.4.0 (tarball Fri Apr 11 22:43:17 UTC 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen

Program execution:
mono test.exe

Program output:
0.0000000000000000 != 1.23456789

Stack trace:
Unhandled Exception:
System.FormatException: Unknown char
  at System.Double.Parse (System.String s, NumberStyles style, IFormatProvider provider) [0x00000] in <filename unknown>:0 
  at System.Double.Parse (System.String s, IFormatProvider provider) [0x00000] in <filename unknown>:0 
  at System.NumberFormatter.FormatRoundtrip (Double origval, System.Globalization.NumberFormatInfo nfi) [0x00000] in <filename unknown>:0 
  at System.NumberFormatter.NumberToString (System.String format, Double value, IFormatProvider fp) [0x00000] in <filename unknown>:0 
  at System.Double.ToString (System.String format, IFormatProvider provider) [0x00000] in <filename unknown>:0 
  at Repro.Program.ThreadProc (System.Object state) [0x00000] in <filename unknown>:0
Comment 1 Juan C. Olivares 2014-07-29 23:42:23 UTC
The bug doesn't exist anymore on git, so it should work OK on release 3.6.x.
Comment 2 Gabriel Acevedo 2014-07-29 23:51:59 UTC
Thanks JC. Duplicate of #18599

*** This bug has been marked as a duplicate of bug 18599 ***