问题
FSDKCam.GetVideoFormatList is a method from external .NET dll. As you see the image, it throws an exception in try-catch block.
try
{
FSDKCam.GetVideoFormatList(ref cameraList[0], out formatList, out count);
if (count > 0) cmbCameraList.Items.Add(cam);
}
catch { }
Screenshot:
回答1:
In .NET 4, AccessViolationException
is not catchable by default.
See the legacyCorruptedStateExceptionsPolicy configuration element. They did this because people have try {} catch (Exception) {}
throughout their code and it is usually not a good idea to catch AccessViolationException
(along with a few others) and continue.
Additionally, see http://msdn.microsoft.com/en-us/magazine/dd419661.aspx
来源:https://stackoverflow.com/questions/7361992/why-try-catch-block-cannot-handle-the-exception