C# postsharp方面导致在方法的“末尾”抛出异常
我在C中使用PostSharp,用于在代码库中使用AOP。最近我注意到错误不是在实际抛出的地方抛出的,而是在方法的末尾抛出的,该方法使用了任何方面。例如,以下面的示例代码为例:C# postsharp方面导致在方法的“末尾”抛出异常,c#,aop,postsharp,C#,Aop,Postsharp,我在C中使用PostSharp,用于在代码库中使用AOP。最近我注意到错误不是在实际抛出的地方抛出的,而是在方法的末尾抛出的,该方法使用了任何方面。例如,以下面的示例代码为例: public void methodUsingAspects() { doSomething1(); doSomethingWhichThrowsError(); //an error is thrown in this method doSomething
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.
错误显示为在最后一个花括号}处抛出。这是非常令人沮丧的,尤其是当错误被抛出到方法所做的调用的深处时
我可以假设为什么会这样做,因为代码已经更改了——但是有可能让它保持原来的工作状态吗