I stripped my addin down to include this line in ConnectToSw()
_swApplication.ActiveDocChangeNotify += new DSldWorksEvents_ActiveDocChangeNotifyEventHandler(_swApplication_ActiveDocChangeNotify);
When I compile the addin for AnyCpu and run on Win7 x64, SW64 2010 SP0.0 generates a crash report (Windows Error Reporting in Event Viewer\Application) when exiting.
Does this happen to you ?
Fault bucket 8825956, type 4
Event Name: APPCRASH
Response: Not available
Cab Id: 0
Problem signature:
P1: sldworks.exe
P2: 18.0.0.5035
P3: 4ad6bf42
P4: ntdll.dll
P5: 6.1.7600.16385
P6: 4a5be02b
P7: c0000005
P8: 000000000002504f
P9:
P10:
Adding these two lines to DisconnectSW() seems to help. I am surprised that SW doesn't die when the Addin is unloaded manually ...
SolidworksApi macrosMarshal.ReleaseComObject(_swApplication);
GC.WaitForPendingFinalizers();