Invoke ObjectARX acedDisableDefaultARXExceptionHandler from c#

386 Views Asked by At

I'm developing an AutoCAD Plugin, and I can't capture unhandled exceptions.

Tried to use CurrentDomain.UnhandledException and Application.ThreadException, but none of this work.

I would like try the solution suggested in this post:

How to catch unhandled exceptions thrown in AutoCAD.NET

But don't know how to do it. Probably this could be the best solution, so I can show my own Error Dialog (and send report functionality) avoiding AutoCAD's Error Dialog.

2

There are 2 best solutions below

1
On

I don't think there is any way to catch all (or even any) native exceptions in your managed code. At the very least you would need AutoCAD 2013+ with fibers disabled (FIBERWORLD = 0), and even then it's a stretch.

0
On

calling acedDisableDefaultARXExceptionHandler to disable not change anything for me

    // EntryPoint may vary across autocad versions
    [DllImport("acad.exe", EntryPoint = "?acedDisableDefaultARXExceptionHandler@@YAXH@Z")]
    public static extern void acedDisableDefaultARXExceptionHandler(int value);