tonerdo / pose

Replace any .NET method (including static and non-virtual) with a delegate
MIT License
1.08k stars 75 forks source link

Running with opencover #9

Open ilengyel opened 6 years ago

ilengyel commented 6 years ago

We get the following exception when we run our xunit tests wrapped in an open cover:

    CustomControls.TreeListView.TreeListViewTests.BringIntoObject [FAIL]
      System.NotSupportedException : Specified method is not supported.
      Stack Trace:
           at Pose.IL.MethodRewriter.Rewrite()
           at stub_System.CannotUnloadAppDomainException_VisitedCritical(Int32 , RuntimeMethodHandle , RuntimeTypeHandle )
           at dynamic_System.CannotUnloadAppDomainException_SafeVisited(Int32 )
           at stub_System.CannotUnloadAppDomainException_SafeVisited(Int32 , RuntimeMethodHandle , RuntimeTypeHandle )
           at dynamic_CustomControls.TreeListView_OnInputRequest(TreeListView , InputRequest )
           at stub_virt_CustomControls.TreeListView_OnInputRequest(TreeListView , InputRequest , RuntimeMethodHandle , RuntimeTypeHandle )
           at dynamic_CustomControls.TreeListView.TreeListViewTests+<>c__DisplayClass0_0_<BringIntoObject>b__0(<>c__DisplayClass0_0 )

If we run the same set of tests without open cover, the desired methods appear to be shimmed just fine. I attempted to reproduce this in a minimal project to no success yet, and it also shims just fine with open cover enabled. Let me know if more effort is needed to attempt to reproduce.

tonerdo commented 6 years ago

@ilengyel I'm working on reproducing this

bruno-garcia commented 6 years ago

Same when using dotCover. I guess having both doing IL emit on top of each other isn't working properly?

System.NotSupportedException : Specified method is not supported.
   at Pose.IL.MethodRewriter.Rewrite()
   at stub_...(... , RuntimeMethodHandle , RuntimeTypeHandle )
   at dynamic_...Tests+<>c__DisplayClass7_0_<TestMethod>b__2(<>c__DisplayClass7_0 )