[Mono-bugs] [Bug 60471][Nor] New - decimal parsing is locale dependent

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 19 Jun 2004 17:23:45 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by rbo@acm.org.

http://bugzilla.ximian.com/show_bug.cgi?id=60471

--- shadow/60471	2004-06-19 17:23:45.000000000 -0400
+++ shadow/60471.tmp.17991	2004-06-19 17:23:45.000000000 -0400
@@ -0,0 +1,62 @@
+Bug#: 60471
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: gentoo (2.6 kernel)
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: rbo@acm.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: decimal parsing is locale dependent
+
+Steps to reproduce the problem:
+1. export LC_ALL=pt_BR
+2. save the following code to the file ptbr.cs
+public class PtBrApp
+{
+   public static void Main(string[] args)
+   {
+      decimal value = (decimal)1.1;
+      Console.WriteLine(value);
+   }
+}
+
+3. mcs ptbr.cs
+
+Actual Results:
+Exception caught by the compiler while compiling:
+   Block that caused the problem begin at: ptbr.cs: (5)
+                     Block being compiled: [ptbr.cs: (6),ptbr.cs: (9)]
+System.FormatException: Invalid character at position 1
+        in Decimal.stripStyles (string, System.Globalization.NumberStyles,
+System.Globalization.NumberFormatInfo, int&, bool&, bool&, int&)
+        in Decimal.Parse (string, System.Globalization.NumberStyles,
+System.IFormatProvider)
+        in Decimal.Parse (string, System.Globalization.NumberStyles)
+        in Decimal..ctor (double)
+        in Decimal.op_Explicit (double)
+        in Cast.TryReduce (Mono.CSharp.EmitContext, System.Type)
+        in Cast.DoResolve (Mono.CSharp.EmitContext)
+        in Expression.Resolve (Mono.CSharp.EmitContext,
+Mono.CSharp.ResolveFlags)
+        in Expression.Resolve (Mono.CSharp.EmitContext)
+        in Assign.DoResolve (Mono.CSharp.EmitContext)
+        in Expression.Resolve (Mono.CSharp.EmitContext,
+Mono.CSharp.ResolveFlags)
+        in Expression.Resolve (Mono.CSharp.EmitContext)
+        in ExpressionStatement.ResolveStatement (Mono.CSharp.EmitContext)
+        in StatementExpression.Resolve (Mono.CSharp.EmitContext)
+        in Block.Resolve (Mono.CSharp.EmitContext)
+        in EmitContext.EmitTopBlock (Mono.CSharp.Block,
+Mono.CSharp.InternalParameters, Mono.CSharp.Location)
+
+
+Expected Results:
+Compilation succeeded