[Mono-bugs] [Bug 36052][Nor] New - System.Activator doesn't work on Structuers

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
23 Dec 2002 05:12:16 -0000

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 tima@staff.airnet.com.au.


--- shadow/36052	Mon Dec 23 00:12:16 2002
+++ shadow/36052.tmp.1257	Mon Dec 23 00:12:16 2002
@@ -0,0 +1,56 @@
+Bug#: 36052
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 7.3
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: tima@staff.airnet.com.au               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: System.Activator doesn't work on Structuers
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+Steps to reproduce the problem:
+1. Create a structure as below
+public struct myStruct {
+   string s;
+   int i;
+2. Try to create it with System.Activator as follows
+myStruct s = new myStruct();
+object output = Activator.CreateInstance(s.GetType());
+Actual Results:
+It fail with a
+System.MissingMethodException: Default constructor not found
+Expected Results:
+Structure should be created and put in to output. Works with MS version of 
+How often does this happen? 
+Every time.
+Additional Information:
+It appears that you are trying to call a constructor on a structure. As 
+far as I know structures don't have constructors. Activator needs to take 
+this into account.