Reflection.Emit chokes on method/type parameters - by RolfBjarne

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


2
0
Sign in
to vote
ID 270717 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 4/13/2007 12:30:37 PM
Access Restriction Public

Description

Compile and run the attached VB code.

The program is trying to compile the following VB code:

Namespace TypeParameter1
    Class C1(Of Y)
    End Class
    Class C2(Of Z)
        Inherits C1(Of Z)
    End Class
    Class C3
        Sub M1(Of A As New)()
        End Sub
        Sub M2(Of B)()
        End Sub
    End Class
End Namespace

Note that the resulting exception is talking about the type argument 'B' on TypeParameter1.C1`1[A], but A and B are method type parameters in class C3... the exception really does not make any sense.

I have also included 10 ways to make the code run, from the more logical ones (remove the constraint on A) to other weirder ones (comment out any of the 3 constructors, move any of the 2 methods to any of the other types, or even reorganize the code so that the emission is done in another order).
Sign in to post a comment.
Posted by Microsoft on 4/18/2008 at 3:42 PM
Hello Rolf,

I have followed up with debugger team and we found out that it uncovers a design flaw in CLR implementation. The fix is unfortunatelly too risky to be part of next service pack releases (.NET Framework 3.5 SP1). We have decided to resolve this design issue in next major release of .NET Framework (and not in any future service packs).
Since there's a simple workaround I mentioned earlier, I hope it won't block you in current work.

Thanks,
-Karel Zikmund
Posted by Microsoft on 8/30/2007 at 7:09 PM
Hello Rolf,

Thanks for your report. It shows an error which is visible only during debugging your application. When you run the application without debugger (Start Without Debugging ... Ctrl-F5 in VS), it executes successfully.
The debugging experience is important too though. I will follow up with the debugger team and try to find a solution for this problem.

Thanks!
-Karel Zikmund
Posted by Microsoft on 4/15/2007 at 1:55 AM
Thanks for your feedback. We have reproduced this bug on Visual Studio 2005 SP1, and we are sending this bug to the appropriate group within the VisualStudio Product Team for triage and resolution.

Thank you,
Visual Studio Product Team.
Posted by Microsoft on 4/14/2007 at 6:48 PM
Thank you for your feedback. We are currently investigating. If this issue is urgent, please call support directly (see http://support.microsoft.com).

Thank you,
Visual Studio Product Team