Have a look at this C# code: bool var0; int var1 = 3 + (var0?0:1);
This would be translated to : L0: ldc.i4.3 L1: ldloc.0 L2: brfalse.s L5 L3: ldc.i4.0 L4: br.s L6 L5: ldc.i4.1 L6 : add L7: stloc.1 L8 : According to your correction, I assume that the stack level at the beginning of L6 should be 0, because it's just after a br.s ! But in fact it's 1 ! (The code provided above is 100% valid, and does work on mono of course) I believe the right algorithm should process the code as follows : Before L0 : 0 ==> After L0 : 1 Before L1 : 1 ==> After L1 : 2 Before L2 : 2 ==> After L2 : 1 ==> Before L5 = 1 Before L3 : 1 ==> After L3 : 2 Before L4 : 2 ==> ==> Before L6 = 2 But we can't assume anything here about After L4 Before L5 = 1 ==> After L5 = 2 Before L6 = 2 ==> After L6 = 1 Before L7 = 1 ==> After L7 = 0 Correct me if I'm wrong --~--~---------~--~----~------------~-------~--~----~ -- mono-cecil -~----------~----~----~----~------~----~------~--~---
