[Mono-dev] Embeded : NullReferenceException not raised when using managed null objects on Windows
Damien
maitredede at gmail.com
Thu Jan 21 09:29:59 EST 2010
Hi,
I am using Windows 7 x86, Visual Studio 2008, Mono 2.6.1 embeded (installed
from windows setup).
When I should have a NullReferenceException (bug in code), a managed
NullReference is not thrown, but a native error occurs (Access violation,
memory 0x00000000).
Here is the calling C++ code :
MonoObject* CMonoHelpers::MONO_CALL(void* target, MonoMethod* methodHandle,
void** args)
{
MonoObject* exception = NULL;
MonoObject* ret = mono_runtime_invoke(methodHandle, target, args,
&exception);
if(exception)
{
mono_print_unhandled_exception(exception);
return NULL;
}
else
{
return ret;
}
};
Here is the C# called code :
internal bool Init()
{
try
{
object o = null;
Console.WriteLine(o.ToString());
}
catch (NullReferenceException ex)
{
//error handling
}
}
On linux Ubuntu x86 Mono 2.4.2.3, the NullReference is thrown and caught...
Can someone see if he has the same behavior ?
Thanks
Damien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100121/177976d7/attachment.html
More information about the Mono-devel-list
mailing list