[Mono-bugs] [Bug 49986][Wis] New - Activator.CreateInstance fails when called by generated types

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 19 Jan 2004 07:20:54 -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 vargaz@freemail.hu.

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

--- shadow/49986	2004-01-19 07:20:54.000000000 -0500
+++ shadow/49986.tmp.5252	2004-01-19 07:20:54.000000000 -0500
@@ -0,0 +1,158 @@
+Bug#: 49986
+Product: Mono/Runtime
+Version: unspecified
+OS: unknown
+OS Details: 
+Status: NEEDINFO   
+Resolution: 
+Severity: Unknown
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: orphennui@yahoo.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Activator.CreateInstance fails when called by generated types
+
+Using the cookcomputing xmlrpc library
+(http://www.xml-rpc.net/release/xml-rpc.net.0.8.1.zip), I get crashes in
+Activator.CreateInstance() called from proxy objects whose types are
+dynamically generated by XmlRpcProxyGen....
+
+
+
+Unhandled Exception: System.Reflection.TargetInvocationException: Exception
+has been thrown by the target of an invocation. --->
+System.NullReferenceException: A null value was found where an object
+instance was required
+in (unmanaged) /lib/i686/libc.so.6 [0x420748d0]
+in (unmanaged) /lib/i686/libc.so.6(malloc+0xa1) [0x42073d81]
+in (unmanaged) /usr/lib/libglib-2.0.so.0(g_malloc+0x2e) [0x401992ba]
+in (unmanaged) /usr/lib/libmono.so.0(mono_mb_new+0x85) [0x40095be5]
+in (unmanaged) /usr/lib/libmono.so.0(mono_marshal_get_native_wrapper+0xcf)
+[0x4009aeab]
+in (unmanaged) /usr/lib/libmono.so.0(mono_arch_create_jit_trampoline+0x15f)
+[0x40079ebf]
+in (unmanaged) /usr/lib/libmono.so.0(mono_class_vtable+0x20e) [0x40085f1e]
+in (unmanaged) /usr/lib/libmono.so.0(mono_array_new_full+0x10c) [0x400877c8]
+in (unmanaged) /usr/lib/libmono.so.0 [0x4008c059]
+in [0x00033] (at
+/gnome/head/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:198)
+System.Reflection.MonoCMethod:Invoke
+(object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
+--- End of inner exception stack trace ---
+ 
+in [0x00052] (at
+/gnome/head/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:202)
+System.Reflection.MonoCMethod:Invoke
+(object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
+in [0x00007] (at
+/gnome/head/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:207)
+System.Reflection.MonoCMethod:Invoke
+(System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
+in [0x000d8] (at /gnome/head/mono/mcs/class/corlib/System/Activator.cs:221)
+System.Activator:CreateInstance
+(System.Type,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo,object[])
+in [0x0000c] (at /gnome/head/mono/mcs/class/corlib/System/Activator.cs:180)
+System.Activator:CreateInstance
+(System.Type,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
+in [0x00277] (at /gnome/head/blog/xmlrpc/src/XmlRpcSerializer.cs:683)
+CookComputing.XmlRpc.XmlRpcSerializer:ParseArray
+(System.Xml.XmlNode,System.Type,CookComputing.XmlRpc.XmlRpcSerializer/ParseStack,CookComputing.XmlRpc.MappingAction)
+in [0x000b2] (at /gnome/head/blog/xmlrpc/src/XmlRpcSerializer.cs:536)
+CookComputing.XmlRpc.XmlRpcSerializer:ParseValue
+(System.Xml.XmlNode,System.Type,CookComputing.XmlRpc.XmlRpcSerializer/ParseStack,CookComputing.XmlRpc.MappingAction,System.Type&,System.Type&)
+in [0x0000a] (at /gnome/head/blog/xmlrpc/src/XmlRpcSerializer.cs:492)
+CookComputing.XmlRpc.XmlRpcSerializer:ParseValue
+(System.Xml.XmlNode,System.Type,CookComputing.XmlRpc.XmlRpcSerializer/ParseStack,CookComputing.XmlRpc.MappingAction)
+in [0x00146] (at /gnome/head/blog/xmlrpc/src/XmlRpcSerializer.cs:319)
+CookComputing.XmlRpc.XmlRpcSerializer:DeserializeResponse
+(System.IO.TextReader,System.Type)
+in [0x00015] (at /gnome/head/blog/xmlrpc/src/XmlRpcSerializer.cs:249)
+CookComputing.XmlRpc.XmlRpcSerializer:DeserializeResponse
+(System.IO.Stream,System.Type)
+in [0x0005d] (at /gnome/head/blog/xmlrpc/src/XmlRpcClientProtocol.cs:214)
+CookComputing.XmlRpc.XmlRpcClientProtocol:ReadResponse
+(CookComputing.XmlRpc.XmlRpcRequest,System.Net.WebResponse,System.IO.Stream,System.Type)
+in <0x000a6> (wrapper remoting-invoke-with-check)
+CookComputing.XmlRpc.XmlRpcClientProtocol:ReadResponse
+(CookComputing.XmlRpc.XmlRpcRequest,System.Net.WebResponse,System.IO.Stream,System.Type)
+in [0x000ba] (at /gnome/head/blog/xmlrpc/src/XmlRpcClientProtocol.cs:94)
+CookComputing.XmlRpc.XmlRpcClientProtocol:Invoke (object,string,object[])
+in <0x00094> (wrapper remoting-invoke-with-check)
+CookComputing.XmlRpc.XmlRpcClientProtocol:Invoke (object,string,object[])
+in [0x00004] (at /gnome/head/blog/xmlrpc/src/XmlRpcClientProtocol.cs:57)
+CookComputing.XmlRpc.XmlRpcClientProtocol:Invoke (string,object[])
+in <0x0007b> .XmlRpcProxy817f7406-8557-4b1a-892e-43e1bb417468:getUsersBlogs
+(string,string,string)
+in [0x00041] (at /gnome/head/blog/daybook/BackendBlogger.cs:355)
+Daybook.BackendBlogger:Initialize (Daybook.UserToken)
+in [0x0007b] (at /gnome/head/blog/daybook/BackendManager.cs:148)
+Daybook.BackendManager:LoadBackends (System.Collections.ArrayList)
+in [0x00010] (at /gnome/head/blog/daybook/BackendManager.cs:105)
+Daybook.BackendManager:.ctor ()
+in [0x00007] (at /gnome/head/blog/daybook/Daybook.cs:61)
+Daybook.Daybook:.ctor ()
+in [0x0001c] (at /gnome/head/blog/daybook/Daybook.cs:52)
+Daybook.Daybook:Main (string[])
+
+------- Additional Comments From orphennui@yahoo.com  2003-10-22 02:01 -------
+In this case, the type CreateInstance is trying to construct is an
+n-sized array of structs of a simple type (BlogInfo, containing 3
+string memebrs).  
+
+BlogInfo is defined in a dynamically loaded module, so maybe this is
+the confusion?
+
+------- Additional Comments From vargaz@freemail.hu  2003-10-22 06:53 -------
+Although I get a different stack trace, I checked in a fix for this.
+Could you retry with latest CVS ?
+
+------- Additional Comments From orphennui@yahoo.com  2003-10-23 03:39 -------
+Nope, still getting the same trace.
+
+Also, after removing my modifications to the xmlrpc lib to pass all
+possible BindingFlags, I get:
+
+
+Unhandled Exception: System.NullReferenceException: A null value was
+found where an object instance was required
+in (unmanaged) /lib/i686/libc.so.6 [0x420748d0]
+in (unmanaged) /lib/i686/libc.so.6(malloc+0xa1) [0x42073d81]
+in (unmanaged) /usr/lib/libglib-2.0.so.0(g_malloc+0x2e) [0x401992ba]
+in (unmanaged) /usr/lib/libglib-2.0.so.0(g_utf8_to_utf16+0x11e)
+[0x401ae99e]
+in (unmanaged) /usr/lib/libmono.so.0(mono_string_new+0x3f) [0x40087c33]
+in (unmanaged) /usr/lib/libmono.so.0(mono_param_get_objects+0x167)
+[0x400811b3]
+in (unmanaged) /usr/lib/libmono.so.0 [0x4008b152]
+in [0x00006] (at
+/gnome/head/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:181)
+System.Reflection.MonoCMethod:GetParameters ()
+in [0x0001d] (at
+/gnome/head/mono/mcs/class/corlib/System.Reflection/Binder.cs:243)
+.Default:SelectMethod
+(System.Reflection.BindingFlags,System.Reflection.MethodBase[],System.Type[],System.Reflection.ParameterModifier[])
+in [0x000f3] (at
+/gnome/head/mono/mcs/class/corlib/System/MonoType.cs:95)
+System.MonoType:GetConstructorImpl
+(System.Reflection.BindingFlags,System.Reflection.Binder,System.Reflection.CallingConventions,System.Type[],System.Reflection.ParameterModifier[])
+in [0x00007] (at /gnome/head/mono/mcs/class/corlib/System/Type.cs:786)
+System.Type:GetConstructor (System.Type[])
+in [0x0005c] (at
+/gnome/head/mono/mcs/class/corlib/System/Activator.cs:157)
+System.Activator:CreateInstance (System.Type,object[],object[])
+in [0x00008] (at
+/gnome/head/mono/mcs/class/corlib/System/Activator.cs:137)
+System.Activator:CreateInstance (System.Type,object[])
+... (same as above)
+
+------- Additional Comments From orphennui@yahoo.com  2003-10-23 05:56 -------
+So I did a little playing around, and it turns out the bug is avoided
+if the XmlRpc library is referenced by the main application directly,
+instead of just by a runtime-loaded module.
+
+------- Additional Comments From vargaz@freemail.hu  2003-10-24 10:55 -------
+Could you tell me how to reproduce this bug ?