Skip to content

CSharp Nunit - Unwrap TargetInvocationException #2590

Closed Answered by driverog
driverog asked this question in Questions & Support
Discussion options

You must be logged in to vote

I did manage to solve this issue by changing my approach a little bit, instead of trying to override the actual allure aspect, I created one separate aspect that wraps around the base aspect. In order to do this we need to handle all type of function that we might get there (generics, tasks, etc...), for this purpose I used the library Aspect.Universal by the same contributors of the underlying AspectInjector used in Allure. Basically the code now looks like this.

namespace TestAllureWrap;

[Aspect(Scope.Global)]
public class WrapInvokeAspect : BaseUniversalWrapperAspect
{
    [Advice(Kind.Around, Targets = Target.Method | Target.Constructor)]
    public new object Around(
        [Argument(

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by driverog
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants