Bug 313419 (MONO52375) - Embeded mono weirdness.
Summary: Embeded mono weirdness.
Status: RESOLVED MOVED
Alias: MONO52375
Product: Mono: Runtime
Classification: Mono
Component: misc (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-19 21:30 UTC by tambet
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:22:27 UTC


---- Reported by tambet@ximian.com 2003-12-19 14:30:48 MST ----

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.



---- Additional Comments From vargaz@freemail.hu 2004-02-05 07:04:11 MST ----

You need to call mono_thread_attach (domain) before calling 
mono_runtime_invoke so the runtime can create its per-thread data
structures.


*** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO53893 ***


Unknown operating system unknown. Setting to default OS "Other".
This bug was marked DUPLICATE in the database it was moved from.
    Changing resolution to "MOVED"