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 (show other bugs)
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)

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

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

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 ***

Note You need to log in before you can comment on or make changes to this bug.