Getting a System.AccessViolationException only dur

2019-07-20 16:24发布

UPDATE

I've changed the question with my latest findings and simplified as much as possible.

I have the following piece of code

public virtual int DefineAction(bool b, string s, Type1 t1, Type2 t2)
{
    return 1;
}

public ProcessResult Process(bool b, string s, Type1 t1, Type2 t2)
{
   int i = DefineAction(b, s, t1, t2);    
   // more code
}

When I put a breakpoint on the Line var int i= ... and I try to step through it I get an AccessVialoationExeption

UPDATE: If I remove virtual for the function DefineAction no Exeption is thrown.

UPDATE2: If I remove one parameter fromDefineAction for example define it as DefineAction(bool b, string s, Type1 t1) no Exeption is thrown. It's freaking me out now :-(

None of the Assemblies is marked as unsafe. There's nothing running in separate threads.

If I run the program in Visual Studio in Debug mode without breakpoint, the Exeption is not throwing

Any hints or ideas how what's going wrong here?