MethodDecorator.Fody throws exception for the generic methods taking ref as parameter

20 Views Asked by At

I trying to add MethodDecorator.Fody in my project.

I added MethodDecorator.Fody and Fody from Nuget packages and configured Aspect (IMethodDecorator, IAspectMatchingRule) at assembly level

Getting exception: Managed Debugging Assistant 'FatalExecutionEngineError' : 'The runtime has encountered a fatal error. The address of the error was at 0x7180b18f, on thread 0x9700. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.'

below code throws exception

public class GenClass
{
    public void Method3<T>(ref T data, T value)
    {
        if (!Equals(data, value))
        {
            data = value;
            //OnPropertyChanged(name);
        }
    }
}

Calling from main:

Main()
{
    GenClass obj = new GenClass();
    int i10 = 10;
    obj.Method3(ref i10, 20);
}

I tried with .net 48 and latest Fody packages.

expected: OnException should work for a method taking ref parameter for variable like int

0

There are 0 best solutions below