Is it possible to catch an access violation exception in .NET?

后端 未结 5 770
广开言路
广开言路 2020-12-01 10:38

Is there anything I can do to catch an AccessViolationException? It is being thrown by a unmanaged DLL that I don\'t control.

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 11:02

    Yes.

    In your App.confg, plop the following code within the tag:

    
        
    
    

    Now you should be able to catch corrupted state exceptions (CSE) like any other.

    Note: If you already have a runtime tag then simply add to it

    The above works for .Net 4.5

提交回复
热议问题