Dir*_*irk 12 .net c# exception-handling 32bit-64bit
我在c#webservice应用程序中遇到问题.异常不再处理某一点.应用程序只需在没有任何进一步的消息/故障异常的情 这是发生的事情:
问题:
我到目前为止采取的步骤或其他可能有用的信息:
它来了!我的原始代码如下所示:
try
{
//some code here throws an exception
}
catch (Exception ex)
{
throw new Exception("some message", ex); //after this line no activity anymore
}
Run Code Online (Sandbox Code Playgroud)
当我将其更改为:
Exception myex = null;
try
{
//some code here throws an exception
}
catch (Exception ex)
{
myex = new Exception("some message", ex);
return null;
}
finally
{
if (myex!=null) throw myex;
}
Run Code Online (Sandbox Code Playgroud)
我的问题解决了!?有没有人对这种行为有解释?我希望依靠正常的异常处理机制.
另一句话:当我在try {}部分之前放置一个'throw new Exception()'时,我的代码运行正常(但当然,我不希望这样).
任何人都有任何线索?提前致谢!
归档时间: |
|
查看次数: |
1258 次 |
最近记录: |