Nim*_*oud 2 c# exception-handling access-violation
FSDKCam.GetVideoFormatList是来自外部.NET dll的方法.当您看到图像时,它会在try-catch块中抛出异常.
try
{
FSDKCam.GetVideoFormatList(ref cameraList[0], out formatList, out count);
if (count > 0) cmbCameraList.Items.Add(cam);
}
catch { }
Run Code Online (Sandbox Code Playgroud)
截图:

在.NET 4中,AccessViolationException默认情况下不可捕获.
请参阅legacyCorruptedStateExceptionsPolicy配置元素.他们之所以这样做,是因为人们在try {} catch (Exception) {}整个代码中都有这种情况,抓住AccessViolationException(以及其他一些人)并继续下去通常不是一个好主意.
另请参阅http://msdn.microsoft.com/en-us/magazine/dd419661.aspx
| 归档时间: |
|
| 查看次数: |
1243 次 |
| 最近记录: |