[Mono-devel-list] Different behavior running code under mono vs. mono_runtime_invoke?
Candace Bain
Candace_Bain at avid.com
Fri Jun 13 17:17:25 EDT 2003
Just sending more information about this problem, someone suggested that
the mono executable might be picking up different library versions or a
different library order than my application so I dumped out the library
information with ldd and they're using exactly the same libraries:
[root at jabber test]# ldd TNGTest
libmono.so.0 => /root/install/lib/libmono.so.0 (0x40018000)
libgmodule-2.0.so.0 => /usr/local/lib/libgmodule-2.0.so.0
(0x4012d000)
libdl.so.2 => /lib/libdl.so.2 (0x40146000)
libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x4014a000)
libm.so.6 => /lib/i686/libm.so.6 (0x401ae000)
libnsl.so.1 => /lib/libnsl.so.1 (0x401d1000)
libpthread.so.0 => /lib/i686/libpthread.so.0 (0x401e8000)
librt.so.1 => /lib/librt.so.1 (0x401fd000)
libc.so.6 => /lib/i686/libc.so.6 (0x4020f000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
[root at jabber test]# ldd /root/install/bin/mono
libmono.so.0 => /root/install/lib/libmono.so.0 (0x40018000)
libgmodule-2.0.so.0 => /usr/local/lib/libgmodule-2.0.so.0
(0x4012d000)
libdl.so.2 => /lib/libdl.so.2 (0x40146000)
libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x4014a000)
libm.so.6 => /lib/i686/libm.so.6 (0x401ae000)
libnsl.so.1 => /lib/libnsl.so.1 (0x401d1000)
libpthread.so.0 => /lib/i686/libpthread.so.0 (0x401e8000)
librt.so.1 => /lib/librt.so.1 (0x401fd000)
libc.so.6 => /lib/i686/libc.so.6 (0x4020f000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
-Candace
-----Original Message-----
From: Candace Bain
Sent: Friday, June 13, 2003 10:59 AM
To: mono-devel-list at lists.ximian.com
Subject: [Mono-devel-list] Different behavior running code under mono
vs. mono_runtime_invoke?
Hi folks,
I'm trying to put together a C++ application that calls into .NET code
using mono_runtime_invoke. Most things are working fine, but I've run
into a problem where the same code behaves differently if I run it
directly with mono vs. running it with mono_runtime_invoke. For
example, I need to create a TCP channel. If I create an application
that calls:
Console.WriteLine("About to create channel");
TcpChannel ch = new TcpChannel();
Console.WriteLine("Done creating channel");
And run it under the mono executable it works fine. If I make the same
calls in a method that I invoke from my C++ application by running
mono_runtime_invoke I get the following:
About to create channel
Unhandled Exception: System.TypeInitializationException: An exception
was thrown by the type initializer for System.Net.IPAddress --->
System.FormatException: An invalid IP address was specified
in <0x0055d> 00 System.Net.IPAddress:Parse (string)
in <0x0004a> 00 System.Net.IPAddress:.cctor ()
--- End of inner exception stack trace ---
in (unmanaged) /root/install/lib/libmono.so.0(mono_raise_exception+0x20)
[0x4009b0c4]
in (unmanaged)
/root/install/lib/libmono.so.0(mono_runtime_class_init+0x241)
[0x40097fb9]
in <0x00049> 00
System.Runtime.Remoting.Channels.Tcp.TcpServerChannel:.ctor
(System.Collections.IDictionary,System.Runtime.Remoting.Channels.IServer
ChannelSinkProvider)
in <0x00086> 00 System.Runtime.Remoting.Channels.Tcp.TcpChannel:Init
(System.Collections.IDictionary,System.Runtime.Remoting.Channels.IClient
ChannelSinkProvider,System.Runtime.Remoting.Channels.IServerChannelSinkP
rovider)
in <0x00086> 00 System.Runtime.Remoting.Channels.Tcp.TcpChannel:.ctor
(int)
in <0x00019> 00 System.Runtime.Remoting.Channels.Tcp.TcpChannel:.ctor ()
in <0x00032> 00 TNGTest.ClientTestObject:CreateChannel ()
Segmentation fault
In addition, if I call ToString() on a double value it works fine in an
application I run from the command line, but in code that's executed by
mono_runtime_invoke I get the following:
Unhandled Exception: System.NullReferenceException: A null value was
found where an object instance was required
in <0x00016> 00 System.Globalization.NumberFormatInfo:get_CurrentInfo ()
in <0x00061> 00 System.FloatingPointFormatter:NumberToString ()
in <0x00129> 00 System.FloatingPointFormatter:.ctor
(string,System.Globalization.NumberFormatInfo,double,double,double,int,i
nt,double,double,int,int)
in <0x0007b> 00 System.DoubleFormatter:NumberToString
(string,System.Globalization.NumberFormatInfo,double)
in <0x000cd> 00 System.Double:ToString (string,System.IFormatProvider)
in <0x00017> 00 System.Double:ToString ()
in <0x00027> 00 TNGTest.ClientTestObject:CreateChannel ()
Segmentation fault
Most things are working when I run them in mono_runtime_invoke, for
example if I call ToString() on an int value it works just fine.
Does anyone have any ideas about what might be causing this behavior?
Is there something about running code from mono_runtime_invoke that
could cause it to behave differently than just running it under mono?
Thanks,
-Candace
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
More information about the Mono-devel-list
mailing list