[Mono-bugs] [Bug 59193][Maj] New - Strange crash when costructing object through reflection

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 27 May 2004 11:58:26 -0400 (EDT)


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 lluis@ximian.com.

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

--- shadow/59193	2004-05-27 11:58:26.000000000 -0400
+++ shadow/59193.tmp.29898	2004-05-27 11:58:26.000000000 -0400
@@ -0,0 +1,49 @@
+Bug#: 59193
+Product: Mono: Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: lluis@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Strange crash when costructing object through reflection
+
+The following test case tries to create an IntPtr object and a
+WindowsIdentity object. The creation of the second object throws an 
+InvalidCastException. However, if you remove the creation of the IntPtr
+object or move it after the creation of WindowsIdentity it works.
+
+using System;
+using System.Reflection;
+using System.Runtime.Serialization;
+using System.Security.Principal;
+
+class testing
+{
+	static void Main()
+	{
+		Create (typeof(IntPtr));
+		Create (typeof(WindowsIdentity));
+	}
+	
+	static void Create (Type t)
+	{
+		ConstructorInfo con = t.GetConstructor (BindingFlags.Instance |
+BindingFlags.Public | BindingFlags.NonPublic, null, new Type[] { typeof
+(SerializationInfo), typeof (StreamingContext) }, null );
+		SerializationInfo info = new SerializationInfo (t, new FormatterConverter());
+		info.AddValue ("value", (long) 0);
+		StreamingContext ctx = new StreamingContext (StreamingContextStates.All);
+		object[] pars = new object[] { info, ctx };
+
+		con.Invoke (null, pars);
+	}
+}