.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Crash on Exit

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
csludtke
706 Views, 3 Replies

Crash on Exit

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?

Tags (1)
3 REPLIES 3
Message 2 of 4
StephenPreston
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
Message 3 of 4
CADbloke
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-...

- - - - - - -
working on all sorts of things including www.tvCAD.tv & www.CADreplace.com
Message 4 of 4
csludtke
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.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost