[Mono-bugs] [Bug 71324][Nor] Changed - Cannot use BindGenericParameters on TypeBuilder
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 18 Jan 2005 09:06:40 -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 nazgul@omega.pl.
http://bugzilla.ximian.com/show_bug.cgi?id=71324
--- shadow/71324 2005-01-18 01:49:41.000000000 -0500
+++ shadow/71324.tmp.20309 2005-01-18 09:06:40.000000000 -0500
@@ -60,6 +60,26 @@
.....
tb.CreateType ();
.....
Type gt = tb.GetGenericTypeDefinition();
Type inst = gt.BindGenericParameters (....);
+
+------- Additional Comments From nazgul@omega.pl 2005-01-18 09:06 -------
+Does gmcs really create separate type using GetGenericTypeDefinition for
+every created builder? It seems a little bit redundant, sice TypeBuilder
+"by definition" is a generic System.Type. It works fine on MS.NET
+Beta1 and is IMHO reasonable. But if this is the design of mono's
+classes, then probably we will use some #ifdef workarounds for mono in
+Nemerle compiler.
+
+Especially it should be reconsidered, since GetGenericTypeDefinition
+do not work on MS.NET for not created types. I get:
+Unhandled Exception: System.InvalidOperationException: Operation is
+not valid due to the current state of the object.
+ at System.Reflection.Emit.TypeBuilder.GetGenericTypeDefinition()
+ at ConsoleApplication1.Program.Main(String[] args)
+Unknown signal 79
+
+Of course there are situations when we can't call CreateType before
+instanciating generic type (like in my example in this bug).
+This way I guess gmcs won't work on MS.NET if it's using pattern above.