You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The followings are example assembly. Try ilasm followed by ildasm then EH clauses are reversed -- catching ArithmeticException followed by DivideByZeroException.
.class public _div {
.method public static int32 _div(int32,int32) {
.locals (class [mscorlib]System.Exception,int32)
.maxstack 3
try_start:
ldarg 0
ldarg 1
div
stloc.1
leave.s try_end
try_end:
ldloc.1
br END
arithmetic:
isinst [mscorlib]System.ArithmeticException
stloc 0
leave AEEnd
AEEnd:
ldloc 0
brfalse FAIL
ldc.i4 0xAE
br END
divbyzero:
isinst [mscorlib]System.DivideByZeroException
stloc 0
leave DBZEnd
DBZEnd:
ldloc 0
brfalse FAIL
ldc.i4 0xDB0E
br END
FAIL:
ldc.i4 0x00000000
br END
END:
ret
.try try_start to try_end catch [mscorlib]System.DivideByZeroException handler divbyzero to DBZEnd
.try try_start to try_end catch [mscorlib]System.ArithmeticException handler arithmetic to AEEnd
}
Not clear if this issue needs to be fixed.
IL catch clause are processed in the order that they are specified and the first one that handled the Object kind
handles the exception. It is illegal in C# to have multiple catch clauses that can handle the exception.
As noted the Desktop IL assembler also has this behavior and no one has filed a bug on this .
Activity
Enable ildasm/ilasm round trip testing
Enable ildasm/ilasm round trip testing
Enable ildasm/ilasm round trip testing
Enable ildasm/ilasm round trip testing
Enable ilasm round trip testing
Enable ilasm round trip testing
russellhadley commentedon Apr 6, 2016
@kyulee1 If this is not a regression against desktop would you put it in the Future milestone?
kyulee1 commentedon Apr 6, 2016
Changed it for futher since it's the existing issue in desktop as well.
briansull commentedon Sep 28, 2020
Not clear if this issue needs to be fixed.
IL catch clause are processed in the order that they are specified and the first one that handled the Object kind
handles the exception. It is illegal in C# to have multiple catch clauses that can handle the exception.
As noted the Desktop IL assembler also has this behavior and no one has filed a bug on this .
Complete managed ildasm and round-trip test support
Complete managed ildasm and round-trip test support