In the past C++/C era, it was very easy to crash AutoCAD or even the whole Operating System. Now in the .NET time, it is harder, much harder than before, but we still can find various ways to crash AutoCAD using its .NET API.
AutoCAD .NET has provided the capability of drawing transient/temporary graphics in its GraphicsInterface namespace in recent versions. Now we can use the API to draw some temporary graphics easily when necessary; otherwise, for the simple task, we have to resort to the JIG API that has some mandatory protocols to be implemented or to invoke some ADS external functions not looking so handsome.
However, simplicity does not equal to reliability. If the AddTransient() call is not properly made for example, AutoCAD will just be crashed hard. Here is such an example.
public static void CrashAutoCAD13_Method()
Editor ed = MgdAcApplication.DocumentManager.MdiActiveDocument.Editor;
new Line(new Point3d(0, 0, 0), new Point3d(10, 10, 0)),
TransientDrawingMode.Main, 0, new IntegerCollection());
catch (System.Exception ex)
ed.WriteMessage(Environment.NewLine + ex.Message);
If we launch AutoCAD, open an existing drawing or create a new one, load the .NET assembly, issue the command, zoom to the transient graphics area, hover the cursor on it from here to there for a while, the AutoCAD will stop working.
If it doesn’t yet at this moment, please don't worry. Just try to zoom again, run the command again, and hover the custor again onto the transient graphics. You won’t miss it!
The leading edge AutoCAD .NET Addin Wizard (AcadNetAddinWizard) provides various project wizards, item wizards, coders and widgets to help program AutoCAD .NET addins.