This is a migrated thread and some comments may be shown as answers.

Invalid C# code generated for nested Enum

1 Answer 72 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 06 Nov 2011, 06:25 PM

Hi,
JustDecompile version 2011.2.1017.4

It seems that enums nested in a generic type decompile to invalid C# code (VB as well). For example, decompiling System.Collections.Concurrent.BlockingCollection<T>, you will find a nested enum called OperationMode, which the current version of JustDecompile decompiles to

private enum OperationMode<T>
{
 
Add
 
Take
}

The <T> should not be part of the name, even though in the IL it is part of the name.

Btw. looking at the IL for enums, I also noticed that the enum is missing the declaration for value__, and also the explicit value assigned to the members are not shown. It might be worth showing the the members as the complete IL definition? 

 

.field public static literal valuetype System.Collections.Concurrent.BlockingCollection`1/OperationMode<!T> Add = int32(0)

1 Answer, 1 is accepted

Sort by
0
Accepted
Yordan Dikov
Telerik team
answered on 09 Nov 2011, 01:36 PM
Hi Chris,

Thanks for the report. Once again this is a corner case we haven't stumbled upon before. Nevertheless we've logged the bugs you pointed out. And I've also updated your Telerik points.

In regard of showing the missing declarations of enum members in IL, until we fix the way we write those you can select the enum's fields in the tree-view on the left and see their complete IL.

All the best,
Yordan Dikov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
General Discussions
Asked by
Chris
Top achievements
Rank 1
Answers by
Yordan Dikov
Telerik team
Share this question
or