How to handle AccessViolationException

后端 未结 5 1823
暖寄归人
暖寄归人 2020-11-22 06:53

I am using a COM object (MODI) from within my .net application. The method I am calling throws a System.AccessViolationException, which is intercepted by Visual Studio. Th

5条回答
  •  生来不讨喜
    2020-11-22 07:47

    Compiled from above answers, worked for me, did following steps to catch it.

    Step #1 - Add following snippet to config file

    
       
          
       
    
    

    Step #2

    Add -

    [HandleProcessCorruptedStateExceptions]
    
    [SecurityCritical]
    

    on the top of function you are tying catch the exception

    source: http://www.gisremotesensing.com/2017/03/catch-exception-attempted-to-read-or.html

提交回复
热议问题