Message 1 of 4
Unhandled Exception C0000005

Not applicable
03-19-2010
12:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
(Access Violation Reading 0xaa00004d)
So... I get this error when exiting AutoCAD 2010. I've narrowed it down to one specific function. If the function is run, the error gets thrown on exit - if the function does not run, there is no error. Can someone shed some light on what the heck I'm doing wrong, please? The function is intended to load a text style based on a specific shx. It does what it should do, except for the error when exiting AutoCAD.
public static void AddTextStyle(String textStyle, String shx)
{
Database db = Application.DocumentManager.MdiActiveDocument.Database;
Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = db.TransactionManager;
Transaction tr = tm.StartTransaction();
TextStyleTable tst = (TextStyleTable)tm.GetObject(db.TextStyleTableId, OpenMode.ForWrite);
TextStyleTableRecord tstr = new TextStyleTableRecord();
tstr.Name = textStyle;
tstr.FileName = shx;
tst.Add(tstr);
tr.AddNewlyCreatedDBObject(tstr, true);
tr.Commit();
tr.Dispose();
tstr.Dispose();
tst.Dispose();
}
So... I get this error when exiting AutoCAD 2010. I've narrowed it down to one specific function. If the function is run, the error gets thrown on exit - if the function does not run, there is no error. Can someone shed some light on what the heck I'm doing wrong, please? The function is intended to load a text style based on a specific shx. It does what it should do, except for the error when exiting AutoCAD.
public static void AddTextStyle(String textStyle, String shx)
{
Database db = Application.DocumentManager.MdiActiveDocument.Database;
Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = db.TransactionManager;
Transaction tr = tm.StartTransaction();
TextStyleTable tst = (TextStyleTable)tm.GetObject(db.TextStyleTableId, OpenMode.ForWrite);
TextStyleTableRecord tstr = new TextStyleTableRecord();
tstr.Name = textStyle;
tstr.FileName = shx;
tst.Add(tstr);
tr.AddNewlyCreatedDBObject(tstr, true);
tr.Commit();
tr.Dispose();
tstr.Dispose();
tst.Dispose();
}