Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/278.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# postsharp方面导致在方法的“末尾”抛出异常_C#_Aop_Postsharp - Fatal编程技术网

C# postsharp方面导致在方法的“末尾”抛出异常

C# postsharp方面导致在方法的“末尾”抛出异常,c#,aop,postsharp,C#,Aop,Postsharp,我在C中使用PostSharp,用于在代码库中使用AOP。最近我注意到错误不是在实际抛出的地方抛出的,而是在方法的末尾抛出的,该方法使用了任何方面。例如,以下面的示例代码为例: public void methodUsingAspects() { doSomething1(); doSomethingWhichThrowsError(); //an error is thrown in this method doSomething

我在C中使用PostSharp,用于在代码库中使用AOP。最近我注意到错误不是在实际抛出的地方抛出的,而是在方法的末尾抛出的,该方法使用了任何方面。例如,以下面的示例代码为例:

    public void methodUsingAspects()
    {
        doSomething1();
        doSomethingWhichThrowsError(); //an error is thrown in this method
        doSomething2();
    } //in visual studio, while debugging, the debugger stops at this line (end of method), not at the actual line the error got thrown.
错误显示为在最后一个花括号}处抛出。这是非常令人沮丧的,尤其是当错误被抛出到方法所做的调用的深处时

我可以假设为什么会这样做,因为代码已经更改了——但是有可能让它保持原来的工作状态吗