Unplanned
Last Updated: 21 Nov 2019 12:42 by ADMIN
Christoph
Created on: 14 Nov 2019 09:18
Type: Bug Report
0
Decompilation of enums incorrectly displayed in IL

When decompiling an enum and looking at it in IL, the whole type definitions of the underlying type are missing, the assignments are incorrect and there is a sort order issue (JustDecompile sorts according to the Name but should keep the original order how the elements have been compiled).

 

Current decompilation:

.class public auto ansi sealed Hafner.Testing.Enums.CharEnum
    extends [mscorlib]System.Enum
{
    Alpha = α
    Beta = β
    Chi = χ
    Delta = δ
    Epsilon = ϵ
    Eta = η
    Gamma = γ
    Iota = ι
    Kappa = κ
    Lambda = λ
    Mu = μ
    Nu = ν
    Omega = ω
    Omicron = o
    Phi = ϕ
    Pi = π
    Psi = ψ
    Rho = ρ
    Sigma = σ
    Tau = τ
    Theta = θ
    Upsilon = υ
    Xi = ξ
    Zeta = ζ
}

 

Expected decompilation:

.class public auto ansi sealed Hafner.Testing.Enums.CharEnum
       extends [mscorlib]System.Enum
{
	.field public specialname rtspecialname char value__
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Alpha = char(0x03B1)    //'α'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Beta = char(0x03B2)     //'β'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Gamma = char(0x03B3)    //'γ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Delta = char(0x03B4)    //'δ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Epsilon = char(0x03F5)  //'ϵ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Zeta = char(0x03B6)     //'ζ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Eta = char(0x03B7)      //'η'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Theta = char(0x03B8)    //'θ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Iota = char(0x03B9)     //'ι'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Kappa = char(0x03BA)    //'κ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Lambda = char(0x03BB)   //'λ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Mu = char(0x03BC)       //'μ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Nu = char(0x03BD)       //'ν'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Xi = char(0x03BE)       //'ξ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Omicron = char(0x006F)  //'o'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Pi = char(0x03C0)       //'π'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Rho = char(0x03C1)      //'ρ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Sigma = char(0x03C3)    //'σ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Tau = char(0x03C4)      //'τ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Upsilon = char(0x03C5)  //'υ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Phi = char(0x03D5)      //'ϕ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Chi = char(0x03C7)      //'χ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Psi = char(0x03C8)      //'ψ'
	.field public static literal valuetype Hafner.Testing.Enums.FlagsVanillaChar Omega = char(0x03C9)    //'ω'

}


The displayed IL code is not valid IL and lots of details are missing. It would be nice if that could be fixed.

I attach a test DLL (still status 'work in progress') with different valid and invalid enum definitions on which you can try out any fixed code.

Best regards
Christoph

Attached Files:
0 comments