Linked Questions

Popular Questions

Unable to catch .NET errors in IronPython

Asked by At

i could not error handling Error from .NET Dll when call different methods of an object. I got this error with IronPython:

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Microsoft.Scripting.Interpreter.FuncCallInstruction`2.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0, T1 arg1, T2 arg2)
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)

I added try and exception as:

import System
for i in dir(object):
    try:
        getattr(object,i)()
    expcept  System.AccessViolationException as e:
        print i,e
    expcept  Exception as e:
        print i,e

However, the Unhandled Exception still crashes my code. How to make error handling in this case.

Related Questions