Export to GitHub

linfu - issue #4

Weaving inserts incorrect jump points in some assemblies


Posted on May 23, 2008 by Swift Cat

What steps will reproduce the problem? 1. This is an intermittent bug. I am not completely sure what conditions will reproduce it repeatably; however, it only occurs after postweaving. I am going to attempt to look into it.

The issue produces a System.InvalidProgramException. On runing peverify.exe against the assembly, I have so far seen these two errors:

  1. Branch out of the method
  2. jmp / exception into the middle of an instruction

What version of the product are you using? On what operating system?

120, Windows XP, .NET 3.5, VS 2008 C#

Please provide any additional information below.

This may be too much detail, but I tried posting it elsewhere, however, it did not successfully post possibly because of its size.

I'm posting the peverify errors and the ILDasm for the particular methods in this message.

PEVerify output: UIManager::ShowPage][offset 0x000001E6] Branch out of the method.

ILDasm for the method: .method public hidebysig newslot virtual final instance void ShowPage(string thePage) cil managed { // Code size 585 (0x249) .maxstack 129 .locals init ([0] object V_0, [1] bool V_1, [2] class [mscorlib]System.Type[] V_2, [3] class [mscorlib]System.Reflection.MethodBase V_3, [4] object[] V_4, [5] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext V_5, [6] class [mscorlib]System.Type[] V_6, [7] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke V_7, [8] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement V_8, [9] object V_9, [10] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider V_10, [11] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke[] V_11, [12] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvokeProvider V_12) IL_0000: ldarg.0 IL_0001: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_0006: brfalse IL_001b IL_000b: ldarg.0 IL_000c: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_0011: callvirt instance bool [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType::get_IsInterceptionEnabled() IL_0016: brfalse IL_01dc IL_001b: nop IL_001c: ldc.i4 0x0 IL_0021: newarr [mscorlib]System.Type IL_0026: stloc V_2 IL_002a: ldc.i4 0x1 IL_002f: newarr [mscorlib]System.Object IL_0034: stloc V_4 IL_0038: ldloc V_4 IL_003c: ldc.i4 0x0 IL_0041: ldarg thePage IL_0045: stelem.ref IL_0046: ldarg.0 IL_0047: ldtoken method instance void Dragonfly.UserInterface.UIManager::ShowPage(string) IL_004c: ldtoken Dragonfly.UserInterface.UIManager IL_0051: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle,

                                                 valuetype

[mscorlib]System.RuntimeTypeHandle) IL_0056: stloc V_3 IL_005a: ldloc V_3 IL_005e: isinst [mscorlib]System.Reflection.MethodInfo IL_0063: ldc.i4.1 IL_0064: ldc.i4.0 IL_0065: newobj instance void [mscorlib]System.Diagnostics.StackTrace::.ctor(int32,

     bool)

IL_006a: ldloc V_2 IL_006e: ldc.i4 0x1 IL_0073: newarr [mscorlib]System.Type IL_0078: stloc V_6 IL_007c: ldloc V_6 IL_0080: ldc.i4 0x0 IL_0085: ldtoken [mscorlib]System.String IL_008a: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) IL_008f: stelem.ref IL_0090: ldloc V_6 IL_0094: ldtoken [mscorlib]System.Void IL_0099: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) IL_009e: ldloc V_4 IL_00a2: newobj instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.InvocationContext::.ctor(object,

                          class [mscorlib]System.Reflection.MethodInfo,

                          class [mscorlib]System.Diagnostics.StackTrace,

                          class [mscorlib]System.Type[],

                          class [mscorlib]System.Type[],

                          class [mscorlib]System.Type,

                          object[])

IL_00a7: stloc V_5 IL_00ab: ldarg.0 IL_00ac: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_00b1: brfalse IL_00fa IL_00b6: ldarg.0 IL_00b7: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_00bc: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType::get_MethodReplacementProvider() IL_00c1: stloc V_10 IL_00c5: ldloc V_10 IL_00c9: brfalse IL_00fa IL_00ce: ldloc V_10 IL_00d2: ldloc V_5 IL_00d6: callvirt instance bool [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider::CanReplace(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_00db: brfalse IL_00fa IL_00e0: ldloc V_10 IL_00e4: ldloc V_5 IL_00e8: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider::GetMethodReplacement(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_00ed: stloc V_8 IL_00f1: ldloc V_8 IL_00f5: brtrue IL_0122 IL_00fa: nop IL_00fb: ldloc V_5 IL_00ff: call class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.MethodReplacementRegistry::GetProvider(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_0104: stloc V_10 IL_0108: ldloc V_10 IL_010c: brfalse IL_0122 IL_0111: ldloc V_10 IL_0115: ldloc V_5 IL_0119: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider::GetMethodReplacement(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_011e: stloc V_8 IL_0122: nop IL_0123: ldc.i4 0x3 IL_0128: newarr [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke IL_012d: stloc V_11 IL_0131: ldloc V_11 IL_0135: ldc.i4 0x0 IL_013a: ldloc V_5 IL_013e: call class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.AroundInvokeRegistry::GetSurroundingImplementation(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_0143: stelem.ref IL_0144: ldarg.0 IL_0145: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_014a: brfalse IL_017e IL_014f: ldarg.0 IL_0150: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_0155: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvokeProvider [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType::get_AroundInvokeProvider() IL_015a: stloc V_12 IL_015e: ldloc V_12 IL_0162: brfalse IL_017e IL_0167: ldloc V_11 IL_016b: ldc.i4 0x1 IL_0170: ldloc V_12 IL_0174: ldloc V_5 IL_0178: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvokeProvider::GetSurroundingImplementation(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_017d: stelem.ref IL_017e: nop IL_017f: ldloc V_11 IL_0183: ldc.i4 0x2 IL_0188: ldloc V_10 IL_018c: isinst [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke IL_0191: stelem.ref IL_0192: ldloc V_11 IL_0196: castclass class [mscorlib]System.Collections.Generic.IEnumerable1&lt;class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke&gt; IL_019b: newobj instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.CompositeAroundInvoke::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable1<class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke>) IL_01a0: castclass [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke IL_01a5: stloc V_7 IL_01a9: ldloc V_7 IL_01ad: brfalse IL_01bf IL_01b2: ldloc V_7 IL_01b6: ldloc V_5 IL_01ba: callvirt instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke::BeforeInvoke(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_01bf: nop IL_01c0: ldloc V_8 IL_01c4: brfalse IL_01dc IL_01c9: ldloc V_8 IL_01cd: ldloc V_5 IL_01d1: callvirt instance object [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement::Invoke(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_01d6: pop IL_01d7: br IL_0235 IL_01dc: nop IL_01dd: nop IL_01de: ldarg.1 IL_01df: call bool [mscorlib]System.String::IsNullOrEmpty(string) IL_01e4: stloc.1 IL_01e5: ldloc.1 IL_01e6: brtrue.s IL_024e IL_01e8: nop IL_01e9: ldarg.0 IL_01ea: ldfld class [PresentationFramework]System.Windows.Navigation.NavigationWindow Dragonfly.UserInterface.UIManager::uiWindow IL_01ef: callvirt instance bool [PresentationCore]System.Windows.UIElement::get_IsVisible() IL_01f4: stloc.1 IL_01f5: ldloc.1 IL_01f6: brtrue.s IL_0206 IL_01f8: nop IL_01f9: ldarg.0 IL_01fa: ldfld class [PresentationFramework]System.Windows.Navigation.NavigationWindow Dragonfly.UserInterface.UIManager::uiWindow IL_01ff: callvirt instance void [PresentationFramework]System.Windows.Window::Show() IL_0204: nop IL_0205: nop IL_0206: ldarg.0 IL_0207: ldfld class Dragonfly.UserInterface.XAMLModifier Dragonfly.UserInterface.UIManager::xamlModifier IL_020c: ldarg.1 IL_020d: callvirt instance object Dragonfly.UserInterface.XAMLModifier::LoadPage(string) IL_0212: stloc.0 IL_0213: ldnull IL_0214: ldloc.0 IL_0215: ceq IL_0217: stloc.1 IL_0218: ldloc.1 IL_0219: brtrue.s IL_022a IL_021b: nop IL_021c: ldarg.0 IL_021d: ldfld class [PresentationFramework]System.Windows.Navigation.NavigationWindow Dragonfly.UserInterface.UIManager::uiWindow IL_0222: ldloc.0 IL_0223: callvirt instance bool [PresentationFramework]System.Windows.Navigation.NavigationWindow::Navigate(object) IL_0228: pop IL_0229: nop IL_022a: nop IL_022b: ldloc V_7 IL_022f: brtrue IL_0236 IL_0234: ret IL_0235: nop IL_0236: nop IL_0237: ldloc V_7 IL_023b: ldloc V_5 IL_023f: ldloc V_9 IL_0243: callvirt instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke::AfterInvoke(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext,

                            object)

IL_0248: ret } // end of method UIManager::ShowPage

Here is what I think is the offending line: IL_01e6: brtrue.s IL_024e

I have virtually no IL experience, however, it looks like the "label" IL_024e does reference a branch outside of the method.

Next Error: UIManager::MediaFileAdded][offset 0x000001E9] Branch out of the method.

.method public hidebysig newslot virtual final instance void MediaFileAdded(class [FES.Data.Order]FES.Data.Order.MediaFile mediaFile) cil managed { // Code size 544 (0x220) .maxstack 115 .locals init ([0] class Dragonfly.UserInterface.MediaFileAddedEventArgs CS$1$0000, [1] bool V_1, [2] class [mscorlib]System.Type[] V_2, [3] class [mscorlib]System.Reflection.MethodBase V_3, [4] object[] V_4, [5] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext V_5, [6] class [mscorlib]System.Type[] V_6, [7] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke V_7, [8] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement V_8, [9] object V_9, [10] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider V_10, [11] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke[] V_11, [12] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvokeProvider V_12) IL_0000: ldarg.0 IL_0001: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_0006: brfalse IL_001b IL_000b: ldarg.0 IL_000c: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_0011: callvirt instance bool [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType::get_IsInterceptionEnabled() IL_0016: brfalse IL_01dc IL_001b: nop IL_001c: ldc.i4 0x0 IL_0021: newarr [mscorlib]System.Type IL_0026: stloc V_2 IL_002a: ldc.i4 0x1 IL_002f: newarr [mscorlib]System.Object IL_0034: stloc V_4 IL_0038: ldloc V_4 IL_003c: ldc.i4 0x0 IL_0041: ldarg mediaFile IL_0045: stelem.ref IL_0046: ldarg.0 IL_0047: ldtoken method instance void Dragonfly.UserInterface.UIManager::MediaFileAdded(class [FES.Data.Order]FES.Data.Order.MediaFile) IL_004c: ldtoken Dragonfly.UserInterface.UIManager IL_0051: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle,

                                                 valuetype

[mscorlib]System.RuntimeTypeHandle) IL_0056: stloc V_3 IL_005a: ldloc V_3 IL_005e: isinst [mscorlib]System.Reflection.MethodInfo IL_0063: ldc.i4.1 IL_0064: ldc.i4.0 IL_0065: newobj instance void [mscorlib]System.Diagnostics.StackTrace::.ctor(int32,

     bool)

IL_006a: ldloc V_2 IL_006e: ldc.i4 0x1 IL_0073: newarr [mscorlib]System.Type IL_0078: stloc V_6 IL_007c: ldloc V_6 IL_0080: ldc.i4 0x0 IL_0085: ldtoken [FES.Data.Order]FES.Data.Order.MediaFile IL_008a: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) IL_008f: stelem.ref IL_0090: ldloc V_6 IL_0094: ldtoken [mscorlib]System.Void IL_0099: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) IL_009e: ldloc V_4 IL_00a2: newobj instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.InvocationContext::.ctor(object,

                          class [mscorlib]System.Reflection.MethodInfo,

                          class [mscorlib]System.Diagnostics.StackTrace,

                          class [mscorlib]System.Type[],

                          class [mscorlib]System.Type[],

                          class [mscorlib]System.Type,

                          object[])

IL_00a7: stloc V_5 IL_00ab: ldarg.0 IL_00ac: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_00b1: brfalse IL_00fa IL_00b6: ldarg.0 IL_00b7: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_00bc: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType::get_MethodReplacementProvider() IL_00c1: stloc V_10 IL_00c5: ldloc V_10 IL_00c9: brfalse IL_00fa IL_00ce: ldloc V_10 IL_00d2: ldloc V_5 IL_00d6: callvirt instance bool [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider::CanReplace(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_00db: brfalse IL_00fa IL_00e0: ldloc V_10 IL_00e4: ldloc V_5 IL_00e8: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider::GetMethodReplacement(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_00ed: stloc V_8 IL_00f1: ldloc V_8 IL_00f5: brtrue IL_0122 IL_00fa: nop IL_00fb: ldloc V_5 IL_00ff: call class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.MethodReplacementRegistry::GetProvider(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_0104: stloc V_10 IL_0108: ldloc V_10 IL_010c: brfalse IL_0122 IL_0111: ldloc V_10 IL_0115: ldloc V_5 IL_0119: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider::GetMethodReplacement(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_011e: stloc V_8 IL_0122: nop IL_0123: ldc.i4 0x3 IL_0128: newarr [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke IL_012d: stloc V_11 IL_0131: ldloc V_11 IL_0135: ldc.i4 0x0 IL_013a: ldloc V_5 IL_013e: call class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.AroundInvokeRegistry::GetSurroundingImplementation(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_0143: stelem.ref IL_0144: ldarg.0 IL_0145: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_014a: brfalse IL_017e IL_014f: ldarg.0 IL_0150: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_0155: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvokeProvider [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType::get_AroundInvokeProvider() IL_015a: stloc V_12 IL_015e: ldloc V_12 IL_0162: brfalse IL_017e IL_0167: ldloc V_11 IL_016b: ldc.i4 0x1 IL_0170: ldloc V_12 IL_0174: ldloc V_5 IL_0178: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvokeProvider::GetSurroundingImplementation(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_017d: stelem.ref IL_017e: nop IL_017f: ldloc V_11 IL_0183: ldc.i4 0x2 IL_0188: ldloc V_10 IL_018c: isinst [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke IL_0191: stelem.ref IL_0192: ldloc V_11 IL_0196: castclass class [mscorlib]System.Collections.Generic.IEnumerable1&lt;class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke&gt; IL_019b: newobj instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.CompositeAroundInvoke::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable1<class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke>) IL_01a0: castclass [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke IL_01a5: stloc V_7 IL_01a9: ldloc V_7 IL_01ad: brfalse IL_01bf IL_01b2: ldloc V_7 IL_01b6: ldloc V_5 IL_01ba: callvirt instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke::BeforeInvoke(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_01bf: nop IL_01c0: ldloc V_8 IL_01c4: brfalse IL_01dc IL_01c9: ldloc V_8 IL_01cd: ldloc V_5 IL_01d1: callvirt instance object [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement::Invoke(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_01d6: pop IL_01d7: br IL_020c IL_01dc: nop IL_01dd: nop IL_01de: ldarg.0 IL_01df: ldfld class [mscorlib]System.EventHandler1&lt;class Dragonfly.UserInterface.MediaFileAddedEventArgs&gt; Dragonfly.UserInterface.UIManager::MediaFileAddedEventHandler IL_01e4: ldnull IL_01e5: ceq IL_01e7: stloc.1 IL_01e8: ldloc.1 IL_01e9: brtrue.s IL_0225 IL_01eb: nop IL_01ec: ldarg.1 IL_01ed: newobj instance void Dragonfly.UserInterface.MediaFileAddedEventArgs::.ctor(class [FES.Data.Order]FES.Data.Order.MediaFile) IL_01f2: stloc.0 IL_01f3: ldarg.0 IL_01f4: ldfld class [mscorlib]System.EventHandler1<class Dragonfly.UserInterface.MediaFileAddedEventArgs> Dragonfly.UserInterface.UIManager::MediaFileAddedEventHandler IL_01f9: ldarg.0 IL_01fa: ldloc.0 IL_01fb: callvirt instance void class [mscorlib]System.EventHandler`1<class Dragonfly.UserInterface.MediaFileAddedEventArgs>::Invoke(object,

                                                           !0)

IL_0200: nop IL_0201: nop IL_0202: ldloc V_7 IL_0206: brtrue IL_020d IL_020b: ret IL_020c: nop IL_020d: nop IL_020e: ldloc V_7 IL_0212: ldloc V_5 IL_0216: ldloc V_9 IL_021a: callvirt instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke::AfterInvoke(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext,

                            object)

IL_021f: ret } // end of method UIManager::MediaFileAdded

Offending line: IL_01e9: brtrue.s IL_0225 Same as before, nothing at IL_0225

peverify error: UIManager+<>c__DisplayClass1::<DisplayMediaFileInFlipper>b__0][offset 0x000001D1] jmp / exception into the middle of an instruction.

.method public hidebysig instance void '<DisplayMediaFileInFlipper>b__0'() cil managed { // Code size 618 (0x26a) .maxstack 138 .locals init ([0] class [PresentationCore]System.Windows.Media.Imaging.BitmapImage V_0, [1] bool V_1, [2] class [mscorlib]System.Type[] V_2, [3] class [mscorlib]System.Reflection.MethodBase V_3, [4] object[] V_4, [5] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext V_5, [6] class [mscorlib]System.Type[] V_6, [7] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke V_7, [8] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement V_8, [9] object V_9, [10] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider V_10, [11] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke[] V_11, [12] class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvokeProvider V_12) IL_0000: ldarg.0 IL_0001: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_0006: brfalse IL_001b IL_000b: ldarg.0 IL_000c: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_0011: callvirt instance bool [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType::get_IsInterceptionEnabled() IL_0016: brfalse IL_01ba IL_001b: nop IL_001c: ldc.i4 0x0 IL_0021: newarr [mscorlib]System.Type IL_0026: stloc V_2 IL_002a: ldc.i4 0x0 IL_002f: newarr [mscorlib]System.Object IL_0034: stloc V_4 IL_0038: ldarg.0 IL_0039: ldtoken method instance void Dragonfly.UserInterface.UIManager/'<>c__DisplayClass1'::'<DisplayMediaFileInFlipper>b__0'() IL_003e: ldtoken Dragonfly.UserInterface.UIManager/'<>c__DisplayClass1' IL_0043: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle,

                                                 valuetype

[mscorlib]System.RuntimeTypeHandle) IL_0048: stloc V_3 IL_004c: ldloc V_3 IL_0050: isinst [mscorlib]System.Reflection.MethodInfo IL_0055: ldc.i4.1 IL_0056: ldc.i4.0 IL_0057: newobj instance void [mscorlib]System.Diagnostics.StackTrace::.ctor(int32,

     bool)

IL_005c: ldloc V_2 IL_0060: ldc.i4 0x0 IL_0065: newarr [mscorlib]System.Type IL_006a: stloc V_6 IL_006e: ldloc V_6 IL_0072: ldtoken [mscorlib]System.Void IL_0077: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) IL_007c: ldloc V_4 IL_0080: newobj instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.InvocationContext::.ctor(object,

                          class [mscorlib]System.Reflection.MethodInfo,

                          class [mscorlib]System.Diagnostics.StackTrace,

                          class [mscorlib]System.Type[],

                          class [mscorlib]System.Type[],

                          class [mscorlib]System.Type,

                          object[])

IL_0085: stloc V_5 IL_0089: ldarg.0 IL_008a: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_008f: brfalse IL_00d8 IL_0094: ldarg.0 IL_0095: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_009a: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType::get_MethodReplacementProvider() IL_009f: stloc V_10 IL_00a3: ldloc V_10 IL_00a7: brfalse IL_00d8 IL_00ac: ldloc V_10 IL_00b0: ldloc V_5 IL_00b4: callvirt instance bool [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider::CanReplace(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_00b9: brfalse IL_00d8 IL_00be: ldloc V_10 IL_00c2: ldloc V_5 IL_00c6: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider::GetMethodReplacement(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_00cb: stloc V_8 IL_00cf: ldloc V_8 IL_00d3: brtrue IL_0100 IL_00d8: nop IL_00d9: ldloc V_5 IL_00dd: call class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.MethodReplacementRegistry::GetProvider(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_00e2: stloc V_10 IL_00e6: ldloc V_10 IL_00ea: brfalse IL_0100 IL_00ef: ldloc V_10 IL_00f3: ldloc V_5 IL_00f7: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider::GetMethodReplacement(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_00fc: stloc V_8 IL_0100: nop IL_0101: ldc.i4 0x3 IL_0106: newarr [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke IL_010b: stloc V_11 IL_010f: ldloc V_11 IL_0113: ldc.i4 0x0 IL_0118: ldloc V_5 IL_011c: call class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.AroundInvokeRegistry::GetSurroundingImplementation(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_0121: stelem.ref IL_0122: ldarg.0 IL_0123: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_0128: brfalse IL_015c IL_012d: ldarg.0 IL_012e: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_0133: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvokeProvider [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType::get_AroundInvokeProvider() IL_0138: stloc V_12 IL_013c: ldloc V_12 IL_0140: brfalse IL_015c IL_0145: ldloc V_11 IL_0149: ldc.i4 0x1 IL_014e: ldloc V_12 IL_0152: ldloc V_5 IL_0156: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvokeProvider::GetSurroundingImplementation(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_015b: stelem.ref IL_015c: nop IL_015d: ldloc V_11 IL_0161: ldc.i4 0x2 IL_0166: ldloc V_10 IL_016a: isinst [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke IL_016f: stelem.ref IL_0170: ldloc V_11 IL_0174: castclass class [mscorlib]System.Collections.Generic.IEnumerable1&lt;class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke&gt; IL_0179: newobj instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.CompositeAroundInvoke::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable1<class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke>) IL_017e: castclass [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke IL_0183: stloc V_7 IL_0187: ldloc V_7 IL_018b: brfalse IL_019d IL_0190: ldloc V_7 IL_0194: ldloc V_5 IL_0198: callvirt instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke::BeforeInvoke(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_019d: nop IL_019e: ldloc V_8 IL_01a2: brfalse IL_01ba IL_01a7: ldloc V_8 IL_01ab: ldloc V_5 IL_01af: callvirt instance object [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement::Invoke(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_01b4: pop IL_01b5: br IL_0256 IL_01ba: nop IL_01bb: nop IL_01bc: ldarg.0 IL_01bd: ldfld class Dragonfly.UserInterface.UIManager Dragonfly.UserInterface.UIManager/'<>c__DisplayClass1'::'<>4__this' IL_01c2: ldfld class [PresentationFramework]System.Windows.Navigation.NavigationWindow Dragonfly.UserInterface.UIManager::uiWindow IL_01c7: callvirt instance object [PresentationFramework]System.Windows.Controls.ContentControl::get_Content() IL_01cc: ldnull IL_01cd: ceq IL_01cf: stloc.1 IL_01d0: ldloc.1 IL_01d1: brtrue.s IL_0191 IL_01d3: nop IL_01d4: ldarg.0 IL_01d5: ldarg.0 IL_01d6: ldfld class Dragonfly.UserInterface.UIManager Dragonfly.UserInterface.UIManager/'<>c__DisplayClass1'::'<>4__this' IL_01db: ldfld class [PresentationFramework]System.Windows.Navigation.NavigationWindow Dragonfly.UserInterface.UIManager::uiWindow IL_01e0: callvirt instance object [PresentationFramework]System.Windows.Controls.ContentControl::get_Content() IL_01e5: castclass [PresentationFramework]System.Windows.Controls.Page IL_01ea: ldstr "loading_image_1" IL_01ef: callvirt instance object [PresentationFramework]System.Windows.FrameworkElement::FindName(string) IL_01f4: stfld object Dragonfly.UserInterface.UIManager/'<>c__DisplayClass1'::imgObj IL_01f9: ldarg.0 IL_01fa: ldfld object Dragonfly.UserInterface.UIManager/'<>c__DisplayClass1'::imgObj IL_01ff: ldnull IL_0200: ceq IL_0202: stloc.1 IL_0203: ldloc.1 IL_0204: brtrue.s IL_024b IL_0206: nop IL_0207: newobj instance void [PresentationCore]System.Windows.Media.Imaging.BitmapImage::.ctor() IL_020c: stloc.0 IL_020d: ldloc.0 IL_020e: callvirt instance void [PresentationCore]System.Windows.Media.Imaging.BitmapImage::BeginInit() IL_0213: nop IL_0214: ldloc.0 IL_0215: ldarg.0 IL_0216: ldfld class Dragonfly.UserInterface.MediaFileAddedEventArgs Dragonfly.UserInterface.UIManager/'<>c__DisplayClass1'::e IL_021b: callvirt instance class [FES.Data.Order]FES.Data.Order.MediaFile Dragonfly.UserInterface.MediaFileAddedEventArgs::get_MediaFile() IL_0220: callvirt instance string [FES.Data.Order]FES.Data.Order.MediaFile::get_RelativeSource() IL_0225: ldc.i4.1 IL_0226: newobj instance void [System]System.Uri::.ctor(string, valuetype [System]System.UriKind) IL_022b: callvirt instance void [PresentationCore]System.Windows.Media.Imaging.BitmapImage::set_UriSource(class [System]System.Uri) IL_0230: nop IL_0231: ldloc.0 IL_0232: callvirt instance void [PresentationCore]System.Windows.Media.Imaging.BitmapImage::EndInit() IL_0237: nop IL_0238: ldarg.0 IL_0239: ldfld object Dragonfly.UserInterface.UIManager/'<>c__DisplayClass1'::imgObj IL_023e: castclass [PresentationFramework]System.Windows.Controls.Image IL_0243: ldloc.0 IL_0244: callvirt instance void [PresentationFramework]System.Windows.Controls.Image::set_Source(class [PresentationCore]System.Windows.Media.ImageSource) IL_0249: nop IL_024a: nop IL_024b: nop IL_024c: ldloc V_7 IL_0250: brtrue IL_0257 IL_0255: ret IL_0256: nop IL_0257: nop IL_0258: ldloc V_7 IL_025c: ldloc V_5 IL_0260: ldloc V_9 IL_0264: callvirt instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke::AfterInvoke(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext,

                            object)

IL_0269: ret } // end of method '<>c__DisplayClass1'::'<DisplayMediaFileInFlipper>b__0'

Offending line: IL_01d1: brtrue.s IL_0191 There is no "label" IL_0191

There are more than one of these "jmp / exception into the middle of an instruction" errors in the next file, however, posting them may be repetitive.

Here's one: .InputDeviceControl.InputDeviceManager::StopScanningForMedia][offset 0x000001C4] jmp / exception into the middle of an instruction.

.method public hidebysig newslot virtual final instance void StopScanningForMedia() cil managed { // Code size 553 (0x229) .maxstack 119 .locals init (class [HostView]InputDeviceContracts.HostViews.IInputDevice V_0, bool V_1, class [mscorlib]System.Collections.Generic.IEnumerator`1<class [HostView]InputDeviceContracts.HostViews.IInputDevice> V_2, class [mscorlib]System.Type[] V_3, class [mscorlib]System.Reflection.MethodBase V_4, object[] V_5, class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext V_6, class [mscorlib]System.Type[] V_7, class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke V_8, class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement V_9, object V_10, class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider V_11, class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke[] V_12, class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvokeProvider V_13) IL_0000: ldarg.0 IL_0001: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_0006: brfalse IL_001b IL_000b: ldarg.0 IL_000c: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_0011: callvirt instance bool [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType::get_IsInterceptionEnabled() IL_0016: brfalse IL_01ba IL_001b: nop IL_001c: ldc.i4 0x0 IL_0021: newarr [mscorlib]System.Type IL_0026: stloc V_3 IL_002a: ldc.i4 0x0 IL_002f: newarr [mscorlib]System.Object IL_0034: stloc V_5 IL_0038: ldarg.0 IL_0039: ldtoken method instance void Dragonfly.InputDeviceControl.InputDeviceManager::StopScanningForMedia() IL_003e: ldtoken Dragonfly.InputDeviceControl.InputDeviceManager IL_0043: call class [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle(valuetype [mscorlib]System.RuntimeMethodHandle,

                                                 valuetype

[mscorlib]System.RuntimeTypeHandle) IL_0048: stloc V_4 IL_004c: ldloc V_4 IL_0050: isinst [mscorlib]System.Reflection.MethodInfo IL_0055: ldc.i4.1 IL_0056: ldc.i4.0 IL_0057: newobj instance void [mscorlib]System.Diagnostics.StackTrace::.ctor(int32,

     bool)

IL_005c: ldloc V_3 IL_0060: ldc.i4 0x0 IL_0065: newarr [mscorlib]System.Type IL_006a: stloc V_7 IL_006e: ldloc V_7 IL_0072: ldtoken [mscorlib]System.Void IL_0077: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) IL_007c: ldloc V_5 IL_0080: newobj instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.InvocationContext::.ctor(object,

                          class [mscorlib]System.Reflection.MethodInfo,

                          class [mscorlib]System.Diagnostics.StackTrace,

                          class [mscorlib]System.Type[],

                          class [mscorlib]System.Type[],

                          class [mscorlib]System.Type,

                          object[])

IL_0085: stloc V_6 IL_0089: ldarg.0 IL_008a: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_008f: brfalse IL_00d8 IL_0094: ldarg.0 IL_0095: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_009a: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType::get_MethodReplacementProvider() IL_009f: stloc V_11 IL_00a3: ldloc V_11 IL_00a7: brfalse IL_00d8 IL_00ac: ldloc V_11 IL_00b0: ldloc V_6 IL_00b4: callvirt instance bool [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider::CanReplace(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_00b9: brfalse IL_00d8 IL_00be: ldloc V_11 IL_00c2: ldloc V_6 IL_00c6: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider::GetMethodReplacement(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_00cb: stloc V_9 IL_00cf: ldloc V_9 IL_00d3: brtrue IL_0100 IL_00d8: nop IL_00d9: ldloc V_6 IL_00dd: call class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.MethodReplacementRegistry::GetProvider(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_00e2: stloc V_11 IL_00e6: ldloc V_11 IL_00ea: brfalse IL_0100 IL_00ef: ldloc V_11 IL_00f3: ldloc V_6 IL_00f7: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacementProvider::GetMethodReplacement(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_00fc: stloc V_9 IL_0100: nop IL_0101: ldc.i4 0x3 IL_0106: newarr [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke IL_010b: stloc V_12 IL_010f: ldloc V_12 IL_0113: ldc.i4 0x0 IL_0118: ldloc V_6 IL_011c: call class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.AroundInvokeRegistry::GetSurroundingImplementation(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_0121: stelem.ref IL_0122: ldarg.0 IL_0123: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_0128: brfalse IL_015c IL_012d: ldarg.0 IL_012e: isinst
[LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType IL_0133: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvokeProvider [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IModifiableType::get_AroundInvokeProvider() IL_0138: stloc V_13 IL_013c: ldloc V_13 IL_0140: brfalse IL_015c IL_0145: ldloc V_12 IL_0149: ldc.i4 0x1 IL_014e: ldloc V_13 IL_0152: ldloc V_6 IL_0156: callvirt instance class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvokeProvider::GetSurroundingImplementation(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_015b: stelem.ref IL_015c: nop IL_015d: ldloc V_12 IL_0161: ldc.i4 0x2 IL_0166: ldloc V_11 IL_016a: isinst [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke IL_016f: stelem.ref IL_0170: ldloc V_12 IL_0174: castclass class [mscorlib]System.Collections.Generic.IEnumerable1&lt;class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke&gt; IL_0179: newobj instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.CompositeAroundInvoke::.ctor(class [mscorlib]System.Collections.Generic.IEnumerable1<class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke>) IL_017e: castclass [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke IL_0183: stloc V_8 IL_0187: ldloc V_8 IL_018b: brfalse IL_019d IL_0190: ldloc V_8 IL_0194: ldloc V_6 IL_0198: callvirt instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke::BeforeInvoke(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_019d: nop IL_019e: ldloc V_9 IL_01a2: brfalse IL_01ba IL_01a7: ldloc V_9 IL_01ab: ldloc V_6 IL_01af: callvirt instance object [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IMethodReplacement::Invoke(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext) IL_01b4: pop IL_01b5: br IL_0215 IL_01ba: nop IL_01bb: nop IL_01bc: ldarg.0 IL_01bd: ldfld bool Dragonfly.InputDeviceControl.InputDeviceManager::stopped IL_01c2: stloc.1 IL_01c3: ldloc.1 IL_01c4: brtrue.s IL_0150 IL_01c6: nop IL_01c7: nop IL_01c8: ldarg.0 IL_01c9: ldfld class [mscorlib]System.Collections.Generic.IList1&lt;class [HostView]InputDeviceContracts.HostViews.IInputDevice&gt; Dragonfly.InputDeviceControl.InputDeviceManager::addins IL_01ce: callvirt instance class [mscorlib]System.Collections.Generic.IEnumerator1<!0> class [mscorlib]System.Collections.Generic.IEnumerable1&lt;class [HostView]InputDeviceContracts.HostViews.IInputDevice&gt;::GetEnumerator() IL_01d3: stloc.2 .try { IL_01d4: br.s IL_01e6 IL_01d6: ldloc.2 IL_01d7: callvirt instance !0 class [mscorlib]System.Collections.Generic.IEnumerator1<class [HostView]InputDeviceContracts.HostViews.IInputDevice>::get_Current() IL_01dc: stloc.0 IL_01dd: nop IL_01de: ldloc.0 IL_01df: callvirt instance void [HostView]InputDeviceContracts.HostViews.IInputDevice::StopScanningForMedia() IL_01e4: nop IL_01e5: nop IL_01e6: ldloc.2 IL_01e7: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() IL_01ec: stloc.1 IL_01ed: ldloc.1 IL_01ee: brtrue.s IL_01d6 IL_01f0: leave.s IL_0202 } // end .try finally { IL_01f2: ldloc.2 IL_01f3: ldnull IL_01f4: ceq IL_01f6: stloc.1 IL_01f7: ldloc.1 IL_01f8: brtrue.s IL_0201 IL_01fa: ldloc.2 IL_01fb: callvirt instance void [mscorlib]System.IDisposable::Dispose() IL_0200: nop IL_0201: endfinally } // end handler IL_0202: nop IL_0203: ldarg.0 IL_0204: ldc.i4.1 IL_0205: stfld bool Dragonfly.InputDeviceControl.InputDeviceManager::stopped IL_020a: nop IL_020b: ldloc V_8 IL_020f: brtrue IL_0216 IL_0214: ret IL_0215: nop IL_0216: nop IL_0217: ldloc V_8 IL_021b: ldloc V_6 IL_021f: ldloc V_10 IL_0223: callvirt instance void [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IAroundInvoke::AfterInvoke(class [LinFu.AOP.Interfaces]LinFu.AOP.Interfaces.IInvocationContext,

                            object)

IL_0228: ret } // end of method InputDeviceManager::StopScanningForMedia

Offending line: IL_01c4: brtrue.s IL_0150 Again, no IL_0150 "Label".

If there is anything I might do to help, please let me know.

Comment #1

Posted on May 23, 2008 by Swift Cat

I figured out how to repeatedly reproduce this problem, but I am not yet sure what to do about it.

To reproduce it, put this function into a C# class and compile it, then run the postweaver on it:

public void FuncTest(String s) { if (!String.IsNullOrEmpty(s)) { string testString = s; } }

The IL code that comes out of this looks something like this:

IL_01cc: ldnull IL_01cd: ceq IL_01cf: stloc.1 IL_01d0: ldloc.1 IL_01d1: brtrue.s IL_0191

In a non-woven assembly, brtrue.s is relative branch to the last instruction in the function - a "ret"

In a woven assembly, the relative location is no longer valid because of the "epilog" that is added to the function by the postweaver. It seems that the same construct causes both peverify errors, i.e., "Branch out of the method", and "jmp / exception into the middle of an instruction". My guess is that somehow, the relative branch needs to be to the beginning of the epilog. How to do this, I have not yet figured out.

Comment #2

Posted on May 31, 2008 by Massive Bird

The AspectWeaver will now modify all Ret instructions inside a method body to jump to a dummy 'Ret' instruction label to signal the end of the method. Bug Fixed.

Status: Fixed

Labels:
Type-Defect Priority-Medium