.NET

Reply
Contributor
csludtke
Posts: 24
Registered: ‎03-17-2003
Message 1 of 4 (295 Views)
Accepted Solution

Crash on Exit

295 Views, 3 Replies
10-21-2013 09:48 AM

I am upgrading a from 2013 to 2014.

 

All of the add-in worked well in 2013.

 

The upgrade went well.  However, when I exit AutoCAD 2014 after loading the add-in, I obtain an exception on exit and get to send an email to Autodesk.

 

I have not been able to capture the exception while debugging.

 

I have started reviewing code to ensure that I have disposed of all items (Application worked nominally in 2013).

 

Is it possible that my solution (upgraded from 2013) does not handle an event fired upon close?  Are there changes that I need to make to 2013 vb.net solution to ensure that the add-in is compatable with 2014?

 

I spent a significant amount of time upgrading the solution from 2009 to 2013.  During that upgrade, I was very careful to use the "Using ... End Using" construct for all AutoCAD objects.  As stated, it works like a charm in 2013.

 

Any clues?

Board Manager
StephenPreston
Posts: 362
Registered: ‎05-22-2006
Message 2 of 4 (266 Views)

Re: Crash on Exit

10-21-2013 10:22 PM in reply to: csludtke

Something like that does normally indicate that you've not cleaned something up as your app is quitting - or objects are getting deleted in the wrong order. Its hard to make suggestions without seeing any code, but I wondered (as a wild guess) - when you quit AutoCAD 2013 while running in your debugger - did  Visual Studio report an exit code that was anything other than zero? If so, then you had a problem in AutoCAD 2013 too, but for some reason AutoCAD 2014 is reacting more violently to it.

 

Also, using the AutoCAD debug symbols may help - http://adndevblog.typepad.com/autocad/2013/04/announcement-autocad-2014-debug-symbols-now-available-...

Cheers,

Stephen Preston
Autodesk Developer Network
Active Contributor
CADbloke
Posts: 37
Registered: ‎08-12-2008
Message 3 of 4 (253 Views)

Re: Crash on Exit

10-22-2013 06:06 PM in reply to: StephenPreston

If you're looking for debug symbold ... link above scored an extra dot at the end. Try http://adndevblog.typepad.com/autocad/2013/04/announcement-autocad-2014-debug-symbols-now-available-...

Contributor
csludtke
Posts: 24
Registered: ‎03-17-2003
Message 4 of 4 (225 Views)

Re: Crash on Exit

10-25-2013 11:29 AM in reply to: csludtke

 

 

Thanks for your help.  Here is a summary of lessons learned.

 

        'This approach to object management and disposal seemed to work well in 2013  
        '(I upgraded code from a 2009 project and replaced the dim obj as new ... --> obj.dispose)  I found multiple portions in the 2009 
        'where the object was not properly disposed.

        Using oAcadDB As Autodesk.AutoCAD.DatabaseServices.Database = Application.DocumentManager.MdiActiveDocument.Database
            Using oAcadTM As Autodesk.AutoCAD.DatabaseServices.TransactionManager = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager
                Using oAcadTR As Autodesk.AutoCAD.DatabaseServices.Transaction = oAcadTM.StartTransaction
                    '....
                    '....
                    '....
                End Using
            End Using
        End Using

        'I changed the above to this simpler version after subsequent calls to Application.DocumentManager.MdiActiveDocument.Database returned a null object
        'error in 2014.  I also reviewed the project, re-wrote sections and removed all references to the COM interface.

        Using oAcadTM As Autodesk.AutoCAD.DatabaseServices.TransactionManager = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager
            Using oAcadTR As Autodesk.AutoCAD.DatabaseServices.Transaction = oAcadTM.StartTransaction
                '....
                '....
                '....
            End Using
        End Using

        'My solution leverages the "BeginSave" event.  In 2009, I had problems and resorted to removing the the event handler 

        Try
            RemoveHandler HostApplicationServices.WorkingDatabase.BeginSave, New DatabaseIOEventHandler(AddressOf IncrementVersionCounter)
        Catch ex As System.Exception

        End Try

        'The above code worked in 2009 & 2013,  It raised an exception in 2014.  

        'Addressing the above seemed to fix the issues in 2014.  Note that the exception on exit was random and seemed to change in frequency when I addressed all of the above.

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community