[Mono-bugs] [Bug 52375][Nor] New - Embeded mono weirdness.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 19 Dec 2003 14:30:48 -0500 (EST)


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 tambet@ximian.com.

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

--- shadow/52375	2003-12-19 14:30:48.000000000 -0500
+++ shadow/52375.tmp.3091	2003-12-19 14:30:48.000000000 -0500
@@ -0,0 +1,65 @@
+Bug#: 52375
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: tambet@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Embeded mono weirdness.
+
+I have simple C file which does something like:
+
+domain = mono_jit_init ("domain");
+assembly = mono_domain_assembly_open (domain, "hello.dll");
+class = mono_class_from_name (assembly->image, "", "Bar");
+mo = mono_object_new (domain, class);
+mdesc = mono_method_desc_new (":blah", FALSE);
+method = mono_method_desc_search_in_class (mdesc, class);
+mono_runtime_invoke (method, mo, NULL, NULL);
+
+And hello.cs which has:
+
+using System;
+
+class Bar {
+	public static void blah() {
+		String a = "4";
+		int b = 4;
+		Console.WriteLine("blah {0}", a);
+		Console.WriteLine("blah {0}", b);
+	}
+}
+
+When I run the C program, I get trace:
+
+blah 4
+ 
+Unhandled Exception: System.NullReferenceException: A null value was found
+where an object instance was required
+in <0x00016> System.Globalization.NumberFormatInfo:get_CurrentInfo ()
+in <0x00066> System.Globalization.NumberFormatInfo:GetInstance
+(System.IFormatProvider)
+in <0x00014> System.Int32:ToString (string,System.IFormatProvider)
+in <0x0022b> System.String:FormatHelper
+(System.Text.StringBuilder,System.IFormatProvider,string,object[])
+in <0x0003f> System.String:Format (System.IFormatProvider,string,object[])
+in <0x00053> System.String:Format (string,object)
+in <0x00016> System.IO.TextWriter:Write (string,object)
+in <0x00038> System.IO.SynchronizedWriter:Write (string,object)
+in <0x0001d> System.Console:WriteLine (string,object)
+in <0x00054> .Bar:blah ()
+
+
+However, if I change last WriteLine to 
+Console.WriteLine("blah {0}", b.ToSting());
+
+It works.