[Mono-devel-list] How to find out the source of NullReferenceException?

Ivan Dubrov WFrag at yandex.ru
Wed Jan 21 07:42:39 EST 2004


Hello!

I've got a code which uses GTK#. This code works nicely under Linux 
(even without any recompilation - just the same binary I've compiled 
with MS .NET), but under Windows both Mono and MS.NET give the same 
exception, here the output from Mono:

Unhandled Exception: System.NullReferenceException: A null value was 
found where an object instance was required
in (unmanaged) (wrapper managed-to-native) 
Gtk.Widget:gtk_widget_show_all (intptr)
in <0x00004> (wrapper managed-to-native) Gtk.Widget:gtk_widget_show_all 
(intptr)
in <0x0001b> Gtk.Widget:ShowAll ()
in <0x00374> GtkSamples.TreeViewDemo:Main (string[])

The problem is gtk_widget_show_all is native function, exported from the 
.dll. So, the question is how to find the source of this exception? 
MonoDebugger doesn't work under Windows (it refused to compile under 
Cygwin). MS debugger doesn't allow to find the source (it doesn't allow 
to enter in native functions, even in the disassembler mode). So, why I 
am asking here? I have a hope that Mono contains some keys (--verbose 
and --trace=all doesn't give me any idea about the source of exception) 
or configuration parameters that could help in this hard task of finding 
the source of evil :)

Any ideas would be appreciated.

P.S. I've included the problem sourcecode in the attachment.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Test.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040121/639e6b43/attachment.pl 


More information about the Mono-devel-list mailing list