18 Replies Latest reply on Sep 8, 2017 12:50 PM by Jacob Corder

    SolidWorks crash without exception - .NET Add-In

    Andrew Johnson

      When I execute a particular command in my .NET Add-In, sometimes (depending on the document) SolidWorks crashes without any .NET Exception thrown from my code. It goes straight to the Windows Error Reporting dialog. When I choose 'Debug' on that dialog, I am able to get some very limited information about the crash in Visual Studio.

       

      Unhandled exception at 0x00007FFA3D63775F (ntdll.dll) in SLDWORKS.exe: 0xC0000374: A heap has been corrupted (parameters: 0x00007FFA3D6986B0).

       

      I'm not managing memory explicitly, so I have no reason to believe that my code is the direct cause. I have stepped line-by-line through my code in Visual Studio to at least find at which line of code the crash occurs, but that is not consistent. It crashes at different points in the code, which also indicates to me that the Add-In is not the root cause. Maybe it's a memory management issue within SolidWorks itself? Anyone have an idea where I should take things from here?

       

      Thanks

        • Re: SolidWorks crash without exception - .NET Add-In
          Jacob Corder

          please elaborate on what this specific command does.  i have spent probably a year suffering through fun solidworks crashes.

           

          post the code if you can.

           

          these can be very in depth. also you cannot really ever trust these exceptions.

           

          if you cannot post the code, post a description of what you are accessing along with what your doing with it.

            • Re: SolidWorks crash without exception - .NET Add-In
              Andrew Johnson

              I won't be able to post the code. This particular command launches a Windows form that allows editing custom properties primarily, but also can do several other things. At the point when the crash occurs, I have read the custom properties and instantiated the form, and the form is in the process of being loaded. Like I said in the original post, the crash does not occur at any particular line. The combination of that inconsistency and the fact that it is a corrupted heap maybe points to the crash occurring during garbage collection, but I don't know how to track it down at that low level.

                • Re: SolidWorks crash without exception - .NET Add-In
                  Jacob Corder

                  so your addin launches a form. does that form get put in a taskpaneview or FeatureMgrView?

                   

                  if you want to know if your form is being garbage collected,

                  Implement IDisposable


                  Garbage collection calls Finalize.

                   

                   

                  if you want something that monitors if a COMObject is garbage collected, i have some code i can share. let me know.

                    • Re: SolidWorks crash without exception - .NET Add-In
                      Jacob Corder
                      Imports System.Runtime.CompilerServices
                      
                      
                      Public Class GCNotifier
                          Implements IDisposable
                          Private map As New ConditionalWeakTable(Of Object, Notifier)
                          Sub New()
                      
                      
                          End Sub
                          Function IsSafe(ThisObj As Object) As Boolean
                              Dim ThisNot As Notifier = Nothing
                              If IsNothing(map) = False And IsNothing(ThisObj) = False Then
                                  Try
                                      map.TryGetValue(ThisObj, ThisNot)
                                      If IsNothing(ThisNot) = False Then
                                          Return ThisNot.IsSafe
                                      End If
                                  Catch ex As Exception
                                  End Try
                              End If
                              Return True
                          End Function
                          Function AddDisplayDimension(ByVal ThisObj As SolidWorks.Interop.sldworks.DisplayDimension, ByVal Description As String) As Notifier
                              'Description is used for callback purposes. use anything you want. it is not required
                              If IsNothing(ThisObj) = False Then
                                  If IsNothing(map) Then map = New ConditionalWeakTable(Of Object, Notifier)
                                  Dim NewNot As Notifier = map.GetOrCreateValue(ThisObj)
                                  If IsNothing(NewNot.m_ObjectToWatch) And IsNothing(NewNot.M_DispDimension) Then
                                      NewNot.Description = Description
                                      NewNot.M_DispDimension = ThisObj
                                      'Below, only finalized gets called as IDisplayDimensions dont implement IDisposable
                                      AddHandler NewNot.ObjectDisposed, AddressOf Me.ObjectDisposed
                                      AddHandler NewNot.ObjectFinalized, AddressOf Me.ObjectFinalized
                                      Return NewNot
                                  End If
                              End If
                              Return Nothing
                          End Function
                          Function AddObject(ByVal ThisObj As Object, ByVal Description As String) As Notifier
                              'Description is used for callback purposes. use anything you want. it is not required
                              If IsNothing(ThisObj) = False Then
                                  If IsNothing(map) Then map = New ConditionalWeakTable(Of Object, Notifier)
                                  Dim NewNot As Notifier = map.GetOrCreateValue(ThisObj)
                                  If IsNothing(NewNot.m_ObjectToWatch) And IsNothing(NewNot.M_DispDimension) Then
                                      NewNot.Description = Description
                                      NewNot.m_ObjectToWatch = ThisObj
                                      'Below, only finalized gets called normally unless the object implements IDisposable
                                      AddHandler NewNot.ObjectDisposed, AddressOf Me.ObjectDisposed
                                      AddHandler NewNot.ObjectFinalized, AddressOf Me.ObjectFinalized
                                      Return NewNot
                                  End If
                              End If
                              Return Nothing
                          End Function
                      
                      
                          Sub RemoveObject(ByVal ThisObj As Object)
                              Dim ThisNot As Notifier = Nothing
                              If IsNothing(ThisObj) = False And IsNothing(map) = False Then
                                  Try
                                      map.TryGetValue(ThisObj, ThisNot)
                                      If IsNothing(ThisNot) = False Then
                                          'Remove Handlers
                                          RemoveHandler ThisNot.ObjectDisposed, AddressOf Me.ObjectDisposed
                                          RemoveHandler ThisNot.ObjectFinalized, AddressOf Me.ObjectFinalized
                                          map.Remove(ThisObj)
                                          ThisNot.Dispose()
                                      End If
                                  Catch ex As Exception
                                  End Try
                              End If
                          End Sub
                          Sub ObjectDisposed(ByVal Sender As Object, ByVal E As EventArgs)
                              '   Debug.Print("Object Disposed")
                          End Sub
                      
                      
                          Sub ObjectFinalized(ByVal Sender As Object, ByVal E As EventArgs)
                              ' Debug.Print("Object Finalized")
                              If IsNothing(Sender) = False AndAlso TypeOf Sender Is Notifier Then
                                  Dim ThisNot As Notifier = Sender
                                  Try
                                      'Remove all objects being watched. the type of object can be modified where you can watch bodies, displayDimensions, faces,edges ect
                                      If IsNothing(ThisNot.m_ObjectToWatch) = False Then
                                          RemoveObject(ThisNot.m_ObjectToWatch)
                                      End If
                                      If IsNothing(ThisNot.M_DispDimension) = False Then
                                          RemoveObject(ThisNot.M_DispDimension)
                                      End If
                                  Catch ex As Exception
                                  End Try
                              End If
                          End Sub
                          Sub RemoveAllConnections()
                              map = Nothing
                          End Sub
                          Class Notifier
                              Implements IDisposable
                              Friend IsSafe As Boolean = True
                              Public Description As String = ""
                              'Add as many specific object types you want here
                              Public m_ObjectToWatch As Object
                              Public M_DispDimension As SolidWorks.Interop.sldworks.DisplayDimension
                              Public Event ObjectDisposed As EventHandler
                              Public Event ObjectFinalized As EventHandler
                      
                      #Region "IDisposable Support"
                              Sub ReRegisterForFinalize()
                                  If IsNothing(M_DispDimension) = False Then
                                      GC.ReRegisterForFinalize(M_DispDimension)
                                  End If
                                  If IsNothing(m_ObjectToWatch) = False Then
                                      GC.ReRegisterForFinalize(m_ObjectToWatch)
                                  End If
                              End Sub
                              Private disposedValue As Boolean ' To detect redundant calls
                      
                      
                              ' IDisposable
                              Protected Overridable Sub Dispose(disposing As Boolean)
                                  If Not Me.disposedValue Then
                                      If disposing Then
                                          RaiseEvent ObjectDisposed(Me, New EventArgs)
                                          ' TODO: dispose managed state (managed objects).
                                      End If
                                      
                                      ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
                                      ' TODO: set large fields to null.
                                  End If
                                  If disposing = False Then RaiseEvent ObjectFinalized(Me, New EventArgs)
                                  m_ObjectToWatch = Nothing
                                  M_DispDimension = Nothing
                                  Me.disposedValue = True
                              End Sub
                      
                      
                              ' TODO: override Finalize() only if Dispose(ByVal disposing As Boolean) above has code to free unmanaged resources.
                              Protected Overrides Sub Finalize()
                                  
                                  ' Do not change this code.  Put cleanup code in Dispose(ByVal disposing As Boolean) above.
                                  Dispose(False)
                                  MyBase.Finalize()
                              End Sub
                      
                      
                              ' This code added by Visual Basic to correctly implement the disposable pattern.
                              Public Sub Dispose() Implements IDisposable.Dispose
                                  ' Do not change this code.  Put cleanup code in Dispose(ByVal disposing As Boolean) above.
                                  Dispose(True)
                                  GC.SuppressFinalize(Me)
                              End Sub
                      #End Region
                      
                      
                          End Class
                      
                      
                      
                      
                      
                      
                      #Region "IDisposable Support"
                          Public Function DestroyAll() As Boolean
                              'Probably a better way to handle this.
                              Finalize()
                          End Function
                          Private disposedValue As Boolean ' To detect redundant calls
                      
                      
                          ' IDisposable
                          Protected Overridable Sub Dispose(disposing As Boolean)
                              If Not Me.disposedValue Then
                                  If disposing Then
                                      ' TODO: dispose managed state (managed objects).
                                  End If
                                  If IsNothing(map) = False Then
                                      map = Nothing
                                  End If
                                  ' TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
                                  ' TODO: set large fields to null.
                              End If
                              Me.disposedValue = True
                          End Sub
                      
                      
                          ' TODO: override Finalize() only if Dispose(ByVal disposing As Boolean) above has code to free unmanaged resources.
                          Protected Overrides Sub Finalize()
                              ' Do not change this code.  Put cleanup code in Dispose(ByVal disposing As Boolean) above.
                              Dispose(False)
                           
                              MyBase.Finalize()
                          End Sub
                      
                      
                          ' This code added by Visual Basic to correctly implement the disposable pattern.
                          Public Sub Dispose() Implements IDisposable.Dispose
                              ' Do not change this code.  Put cleanup code in Dispose(ByVal disposing As Boolean) above.
                              Dispose(True)
                              GC.SuppressFinalize(Me)
                          End Sub
                      #End Region
                      
                      
                      End Class
                      

                       

                      This code captures events when COM Objects are finalized. it uses a ConditionalWeakTable that basically fires finalize on The Notifier class when the COMObject is finalized by garbage collection. so when the COMObject Dies, The Notifier Class gets finalized called by GarbageCollection.

                       

                      this is relatively new code for me. i had to write it because MacroFeature DisplayDimensions get corrupted durring rebuild. so to detect if they have not been correctly finalized, i had to write this.  Why they get finalized is beyond me but they do.

                       

                      any input to the functionality of the code would be appreciated. it works great but hasn't been fully debugged yet.

                      any concerns would also be appreciated. I wrote it out of necessity only.

                    • Re: SolidWorks crash without exception - .NET Add-In
                      Jacob Corder

                      also is this a new issue of old code or new code and new issue?

                      • Re: SolidWorks crash without exception - .NET Add-In
                        Jacob Corder

                        the best way you will be able to find out what is going on is to

                         

                        open solidworks.

                        open WinDBG x64

                        attach to process Sldworks.exe

                        make the crash happen

                         

                        when an exception is thrown, it should pause for you.

                         

                        Type

                        !Analyze -v

                         

                        some things happen and you will be able to see more information than you will using visual studio

                          • Re: SolidWorks crash without exception - .NET Add-In
                            Andrew Johnson

                            If you're in the mood for some light reading, here are the results from WinDBG...

                             

                            HEAP[SLDWORKS.exe]: Heap block at 00000000A0F3B3B0 modified at 00000000A0F3B3C8 past requested size of 8

                            (2150.2c3c): Break instruction exception - code 80000003 (first chance)

                            ntdll!RtlpBreakPointHeap+0x16:

                            00007ffa`3d642476 cc              int     3

                            0:000> !analyze -v

                            *******************************************************************************

                            *                                                                             *

                            *                        Exception Analysis                                   *

                            *                                                                             *

                            *******************************************************************************

                             

                            *** WARNING: Unable to verify checksum for C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Windows.Forms\b7957195b6fde72b45ea581a56db0151\System.Windows.Forms.ni.dll

                            *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Program Files\SOLIDWORKS Corp\2017\SOLIDWORKS\sldappu.dll -

                            *** ERROR: Module load completed but symbols could not be loaded for sldworks.exe

                            *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Program Files\SOLIDWORKS Corp\2017\SOLIDWORKS\sldutu.dll -

                            *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\SYSTEM32\nvoglv64.DLL -

                            *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Program Files\SOLIDWORKS Corp\2017\SOLIDWORKS\sldsearchcommonu.dll -

                            *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Program Files\SOLIDWORKS Corp\2017\SOLIDWORKS\sldsearchu.dll -

                            *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Program Files\SOLIDWORKS Corp\2017\SOLIDWORKS\sldtessellationu.dll -

                            *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Program Files\SOLIDWORKS Corp\2017\SOLIDWORKS\SLDMFCU.dll -

                            *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Program Files\SOLIDWORKS Corp\2017\SOLIDWORKS\RWUXThemeSU11.dll -

                            *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Program Files\SOLIDWORKS Corp\2017\SOLIDWORKS\PSKERNEL.dll -

                            GetUrlPageData2 (WinHttp) failed: 12002.

                             

                            DUMP_CLASS: 2

                            DUMP_QUALIFIER: 0

                            FAULTING_IP:

                            ntdll!RtlpBreakPointHeap+16

                            00007ffa`3d642476 cc              int     3

                             

                            EXCEPTION_RECORD:  (.exr -1)

                            ExceptionAddress: 00007ffa3d642476 (ntdll!RtlpBreakPointHeap+0x0000000000000016)

                               ExceptionCode: 80000003 (Break instruction exception)

                              ExceptionFlags: 00000000

                            NumberParameters: 1

                               Parameter[0]: 0000000000000000

                             

                            FAULTING_THREAD:  00002c3c

                            DEFAULT_BUCKET_ID:  HEAP_CORRUPTION

                            PROCESS_NAME:  sldworks.exe

                            ERROR_CODE: (NTSTATUS) 0x80000003 - {EXCEPTION}  Breakpoint  A breakpoint has been reached.

                            EXCEPTION_CODE: (HRESULT) 0x80000003 (2147483651) - One or more arguments are invalid

                            EXCEPTION_CODE_STR:  80000003

                            EXCEPTION_PARAMETER1:  0000000000000000

                            WATSON_BKT_PROCSTAMP:  597a9683

                            WATSON_BKT_PROCVER:  25.4.0.74

                            PROCESS_VER_PRODUCT:  SolidWorks

                            WATSON_BKT_MODULE:  ntdll.dll

                            WATSON_BKT_MODSTAMP:  b79b6ddb

                            WATSON_BKT_MODOFFSET:  102476

                            WATSON_BKT_MODVER:  10.0.15063.0

                            MODULE_VER_PRODUCT:  Microsoft® Windows® Operating System

                            BUILD_VERSION_STRING:  10.0.15063.296 (WinBuild.160101.0800)

                            MODLIST_WITH_TSCHKSUM_HASH:  6370811bd806513b37c6591118d2f9d45d12b7f0

                            MODLIST_SHA1_HASH:  49a05405fe80acb920fd51494bf0d9bc0fbfeb66

                            NTGLOBALFLAG:  70

                            PROCESS_BAM_CURRENT_THROTTLED: 0

                            PROCESS_BAM_PREVIOUS_THROTTLED: 0

                            APPLICATION_VERIFIER_FLAGS:  0

                            PRODUCT_TYPE:  1

                            SUITE_MASK:  272

                            DUMP_TYPE:  fe

                            MISSING_CLR_SYMBOL: 0

                            ANALYSIS_SESSION_HOST:  WAV-IT-ASJ

                            ANALYSIS_SESSION_TIME:  09-06-2017 15:01:20.0735

                            ANALYSIS_VERSION: 10.0.15063.468 amd64fre

                            MANAGED_CODE: 1

                            MANAGED_ENGINE_MODULE:  clr

                            MANAGED_ANALYSIS_PROVIDER:  SOS

                            MANAGED_THREAD_ID: 2c3c

                            THREAD_ATTRIBUTES:

                            ADDITIONAL_DEBUG_TEXT:  Enable Pageheap/AutoVerifer ; Followup set based on attribute [Is_ChosenCrashFollowupThread] from Frame:[0] on thread:[PSEUDO_THREAD]

                            LAST_CONTROL_TRANSFER:  from 00007ffa3d59e63b to 00007ffa3d642476

                            THREAD_SHA1_HASH_MOD_FUNC:  534aaaba1056d96a5bf340d83f5e53102e2d0099

                            THREAD_SHA1_HASH_MOD_FUNC_OFFSET:  1f24d6d1859fcb61c03ac74a3a99afb3bc19e6e3

                            OS_LOCALE:  ENU

                             

                            PROBLEM_CLASSES:

                                ID:     [0n245]

                                Type:   [HEAP_CORRUPTION]

                                Class:  Primary

                                Scope:  DEFAULT_BUCKET_ID (Failure Bucket ID prefix)

                                        BUCKET_ID

                                Name:   Add

                                Data:   Omit

                                PID:    [0x2150]

                                TID:    [0x2c3c]

                                Frame:  [4] : ntdll!RtlpFreeHeap

                             

                                ID:     [0n245]

                                Type:   [HEAP_CORRUPTION]

                                Class:  Primary

                                Scope:  BUCKET_ID

                                Name:   Add

                                Data:   Omit

                                PID:    [0x2150]

                                TID:    [0x2c3c]

                                Frame:  [4] : ntdll!RtlpFreeHeap

                             

                                ID:     [0n115]

                                Type:   [CLRSETUP_MSCORLIBMISMATCH]

                                Class:  Addendum

                                Scope:  BUCKET_ID

                                Name:   Add

                                Data:   Omit

                                PID:    [0x2150]

                                TID:    [0x2c3c]

                                Frame:  [Unspecified]

                             

                                ID:     [0n91]

                                Type:   [@SHUTDOWN]

                                Class:  Addendum

                                Scope:  BUCKET_ID

                                Name:   Omit

                                Data:   Omit

                                PID:    [0x2150]

                                TID:    [0x4d4]

                                Frame:  [0] : ntdll!NtDelayExecution

                             

                            BUGCHECK_STR:  HEAP_CORRUPTION_CLRSETUP_MSCORLIBMISMATCH

                            PRIMARY_PROBLEM_CLASS:  HEAP_CORRUPTION

                            STACK_TEXT: 00000000`00000000 00000000`00000000 heap_corruption!sldworks.exe+0x0

                            THREAD_SHA1_HASH_MOD:  ca4e26064d24ef7512d2e94de5a93c38dbe82fe9

                            SYMBOL_STACK_INDEX:  0

                            SYMBOL_NAME:  heap_corruption!sldworks.exe

                            FOLLOWUP_NAME:  MachineOwner

                            MODULE_NAME: heap_corruption

                            DEBUG_FLR_IMAGE_TIMESTAMP:  0

                            STACK_COMMAND:  ** Pseudo Context ** ; kb

                            FAILURE_BUCKET_ID:  HEAP_CORRUPTION_80000003_heap_corruption!sldworks.exe

                            BUCKET_ID:  HEAP_CORRUPTION_CLRSETUP_MSCORLIBMISMATCH_heap_corruption!sldworks.exe

                            FAILURE_EXCEPTION_CODE:  80000003

                            IMAGE_NAME:  heap_corruption

                            FAILURE_IMAGE_NAME:  heap_corruption

                            BUCKET_ID_IMAGE_STR:  heap_corruption

                            FAILURE_MODULE_NAME:  heap_corruption

                            BUCKET_ID_MODULE_STR:  heap_corruption

                            FAILURE_FUNCTION_NAME:  sldworks.exe

                            BUCKET_ID_FUNCTION_STR:  sldworks.exe

                            BUCKET_ID_OFFSET:  0

                            BUCKET_ID_MODTIMEDATESTAMP:  0

                            BUCKET_ID_MODCHECKSUM:  0

                            BUCKET_ID_MODVER_STR:  0.0.0.0

                            BUCKET_ID_PREFIX_STR: 

                            FAILURE_PROBLEM_CLASS:  HEAP_CORRUPTION

                            FAILURE_SYMBOL_NAME:  heap_corruption!sldworks.exe

                            WATSON_STAGEONE_URL:  http://watson.microsoft.com/StageOne/sldworks.exe/25.4.0.74/597a9683/ntdll.dll/10.0.15063.0/b79b6ddb/80000003/00102476.htm?Retriage=1

                            TARGET_TIME:  2017-09-06T20:02:02.000Z

                            OSBUILD:  15063

                            OSSERVICEPACK:  296

                            SERVICEPACK_NUMBER: 0

                            OS_REVISION: 0

                            OSPLATFORM_TYPE:  x64

                            OSNAME:  Windows 10

                            OSEDITION:  Windows 10 WinNt SingleUserTS

                            USER_LCID:  0

                            OSBUILD_TIMESTAMP:  unknown_date

                            BUILDDATESTAMP_STR:  160101.0800

                            BUILDLAB_STR:  WinBuild

                            BUILDOSVER_STR:  10.0.15063.296

                            ANALYSIS_SESSION_ELAPSED_TIME:  f41f

                            ANALYSIS_SOURCE:  UM

                            FAILURE_ID_HASH_STRING:  um:heap_corruption_80000003_heap_corruption!sldworks.exe

                            FAILURE_ID_HASH:  {61bd9832-2299-0f8d-f631-583cb4ca503a}

                              • Re: SolidWorks crash without exception - .NET Add-In
                                Jacob Corder

                                type in KB after !Analze -v

                                 

                                This will tell us the last code executed. not like it helps all that much but sometimes it will point to an issue.

                                 

                                hopefully you see one of your methods in there

                                 

                                some windbg codes

                                http://windbg.info/doc/1-common-cmds.html

                                  • Re: SolidWorks crash without exception - .NET Add-In
                                    Andrew Johnson

                                    Unfortunately none of my methods are listed, and nothing is jumping out at me as being significant. Thanks for your help though. WinDBG is clearly a powerful tool.

                                     

                                    # Child-SP          RetAddr           Call Site

                                    00 00000000`005fa3b8 00007ffa`3d59e63b ntdll!RtlpBreakPointHeap+0x16

                                    01 00000000`005fa3c0 00007ffa`3d609a24 ntdll!RtlpCheckBusyBlockTail+0x9f

                                    02 00000000`005fa400 00007ffa`3d5d128d ntdll!RtlpValidateHeapEntry+0x52940

                                    03 00000000`005fa450 00007ffa`3d5f95c9 ntdll!RtlDebugFreeHeap+0x1a1

                                    04 00000000`005fa4b0 00007ffa`3d5711fd ntdll!RtlpFreeHeap+0x866a9

                                    05 00000000`005fa720 00007ffa`0ee77395 ntdll!RtlFreeHeap+0x41d

                                    06 00000000`005fa7e0 00007ffa`3d3ed5e6 AcLayers!NS_FaultTolerantHeap::APIHook_RtlFreeHeap+0x2ff5

                                    07 00000000`005fa840 00007ffa`3d3ed250 OLEAUT32!_SafeArrayDestroyData+0x246

                                    08 00000000`005fa880 00007ffa`3cc1124b OLEAUT32!SafeArrayDestroy+0x40

                                    09 00000000`005fa8c0 00007ffa`0ded812a combase!VariantClear+0x9b [onecore\com\combase\winrt\dispatch\variant.cpp @ 141]

                                    0a 00000000`005fa8f0 00007ffa`0ded80be clr!SafeVariantClearHelper+0x2b

                                    0b 00000000`005fa930 00007ffa`0df77470 clr!SafeVariantClear+0x78

                                    0c 00000000`005fa980 00007ff9`b0d70d74 clr!StubHelpers::ObjectMarshaler__ClearNative+0xa0

                                    0d 00000000`005faad0 00007ff9`b0d70d06 0x00007ff9`b0d70d74

                                    0e 00000000`005fab40 00007ff9`b11aa070 0x00007ff9`b0d70d06

                                    0f 00000000`005fac40 00007ff9`b11a9622 0x00007ff9`b11aa070

                                    10 00000000`005fadb0 00007ff9`b11a4667 0x00007ff9`b11a9622

                                    11 00000000`005faf90 00007ff9`ae9005af 0x00007ff9`b11a4667

                                    12 00000000`005fb100 00007ff9`feca50fc 0x00007ff9`ae9005af

                                    13 00000000`005fb1c0 00007ff9`b05f7381 System_Windows_Forms_ni+0x2550fc

                                    14 00000000`005fb220 00007ff9`feca4b48 0x00007ff9`b05f7381

                                    15 00000000`005fb260 00007ff9`fec936dd System_Windows_Forms_ni+0x254b48

                                    16 00000000`005fb290 00007ff9`fec934ae System_Windows_Forms_ni+0x2436dd

                                    17 00000000`005fb300 00007ff9`feca375e System_Windows_Forms_ni+0x2434ae

                                    18 00000000`005fb350 00007ff9`fec9577f System_Windows_Forms_ni+0x25375e

                                    19 00000000`005fb3a0 00007ff9`feca369f System_Windows_Forms_ni+0x24577f

                                    1a 00000000`005fb490 00007ff9`b05f3ad0 System_Windows_Forms_ni+0x25369f

                                    1b 00000000`005fb4d0 00007ff9`fec953f3 0x00007ff9`b05f3ad0

                                    1c 00000000`005fb540 00007ff9`ff307139 System_Windows_Forms_ni+0x2453f3

                                    1d 00000000`005fb5e0 00007ffa`0de1220e System_Windows_Forms_ni+0x8b7139

                                    1e 00000000`005fb650 00007ffa`3b07bc50 clr!UMThunkStub+0x6e

                                    1f 00000000`005fb6e0 00007ffa`3b07b80b USER32!UserCallWinProcCheckWow+0x280

                                    20 00000000`005fb840 00007ffa`2d4348d0 USER32!CallWindowProcW+0x8b

                                    21 00000000`005fb890 00007ffa`2d4346a7 COMCTL32!CallNextSubclassProc+0xb0

                                    22 00000000`005fb960 00007ff9`b062768a COMCTL32!DefSubclassProc+0x77

                                    23 00000000`005fb9b0 00007ff9`b0627106 0x00007ff9`b062768a

                                    24 00000000`005fba60 00007ff9`b062572c 0x00007ff9`b0627106

                                    25 00000000`005fbb00 00007ffa`0de1220e 0x00007ff9`b062572c

                                    26 00000000`005fbb80 00007ffa`2d434929 clr!UMThunkStub+0x6e

                                    27 00000000`005fbc20 00007ffa`2d434772 COMCTL32!CallNextSubclassProc+0x109

                                    28 00000000`005fbcf0 00007ffa`3b07bc50 COMCTL32!MasterSubclassProc+0xa2

                                    29 00000000`005fbd90 00007ffa`3b07b94c USER32!UserCallWinProcCheckWow+0x280

                                    2a 00000000`005fbef0 00007ffa`3b0911f3 USER32!DispatchClientMessage+0x9c

                                    2b 00000000`005fbf50 00007ffa`3d5e90b4 USER32!_fnDWORD+0x33

                                    2c 00000000`005fbfb0 00007ffa`39c61b64 ntdll!KiUserCallbackDispatcherContinue

                                    2d 00000000`005fc038 00007ff9`fed19094 win32u!NtUserShowWindow+0x14

                                    2e 00000000`005fc040 00007ff9`fec9254c System_Windows_Forms_ni+0x2c9094

                                    2f 00000000`005fc0f0 00007ff9`feca0d1e System_Windows_Forms_ni+0x24254c

                                    30 00000000`005fc1a0 00007ff9`fecaa446 System_Windows_Forms_ni+0x250d1e

                                    31 00000000`005fc200 00007ff9`fecaa201 System_Windows_Forms_ni+0x25a446

                                    32 00000000`005fc290 00007ff9`ff39a1c7 System_Windows_Forms_ni+0x25a201

                                    33 00000000`005fc2f0 00007ff9`b0d4a41e System_Windows_Forms_ni+0x94a1c7

                                    34 00000000`005fc3f0 00007ffa`0de16753 0x00007ff9`b0d4a41e

                                    35 00000000`005fc550 00007ffa`0de16649 clr!CallDescrWorkerInternal+0x83

                                    36 00000000`005fc590 00007ffa`0de47a8a clr!CallDescrWorkerWithHandler+0x4e

                                    37 00000000`005fc5d0 00007ffa`0de4791e clr!CallDescrWorkerReflectionWrapper+0x1a

                                    38 00000000`005fc620 00007ffa`0cd5b764 clr!RuntimeMethodHandle::InvokeMethod+0x56e

                                    39 00000000`005fcc30 00007ffa`0cd52922 mscorlib_ni+0x4cb764

                                    3a 00000000`005fcca0 00007ffa`0cd53f72 mscorlib_ni+0x4c2922

                                    3b 00000000`005fcd20 00007ff9`b0d49834 mscorlib_ni+0x4c3f72

                                    3c 00000000`005fcd60 00007ffa`0de16753 0x00007ff9`b0d49834

                                    3d 00000000`005fcec0 00007ffa`0de16649 clr!CallDescrWorkerInternal+0x83

                                    3e 00000000`005fcf00 00007ffa`0de47a8a clr!CallDescrWorkerWithHandler+0x4e

                                    3f 00000000`005fcf40 00007ffa`0de4791e clr!CallDescrWorkerReflectionWrapper+0x1a

                                    40 00000000`005fcf90 00007ffa`0cd5b6e0 clr!RuntimeMethodHandle::InvokeMethod+0x56e

                                    41 00000000`005fd5a0 00007ffa`0cd52922 mscorlib_ni+0x4cb6e0

                                    42 00000000`005fd610 00007ffa`0de16753 mscorlib_ni+0x4c2922

                                    43 00000000`005fd690 00007ffa`0de16649 clr!CallDescrWorkerInternal+0x83

                                    44 00000000`005fd6e0 00007ffa`0de1732d clr!CallDescrWorkerWithHandler+0x4e

                                    45 00000000`005fd720 00007ffa`0df78e58 clr!MethodDescCallSite::CallTargetWorker+0xf8

                                    46 00000000`005fd830 00007ffa`0df789ba clr!DispatchInfo::InvokeMemberWorker+0xad8

                                    47 00000000`005fe3e0 00007ffa`0df78755 clr!DispatchInfo::InvokeMemberDebuggerWrapper+0x1c6

                                    48 00000000`005fe540 00007ffa`0df79242 clr!DispatchInfo::InvokeMember+0x467

                                    49 00000000`005fe830 00007ffa`0df7909d clr!InternalDispatchImpl_Invoke+0x1ed

                                    4a 00000000`005fe950 00007ffa`0df78fde clr!InternalDispatchImpl_Invoke_CallBack+0xb2

                                    4b 00000000`005fe9b0 00000000`44df4300 clr!InternalDispatchImpl_Invoke_Wrapper+0xf8

                                    4c 00000000`005fea50 00000000`44e0ca2c sldappu!auDispCallback_c::invokeFcn+0x140

                                    4d 00000000`005feb50 00007ff9`fb9831fa sldappu!auFrame_c::iFindMenuItemOnFrame+0x91c

                                    4e 00000000`005feba0 00007ff9`fb98348a mfc110u!_AfxDispatchCmdMsg+0xa2

                                    4f 00000000`005febd0 00007ff9`fba355ba mfc110u!CCmdTarget::OnCmdMsg+0x1a6

                                    50 00000000`005fec30 00007ff9`fba3d16e mfc110u!CFrameWnd::OnCmdMsg+0xa6

                                    51 00000000`005fec90 00007ff9`fba265d0 mfc110u!CMDIFrameWnd::OnCmdMsg+0xfa

                                    52 00000000`005fed00 00007ff9`fba34556 mfc110u!CWnd::OnCommand+0xf4

                                    53 00000000`005fed90 00007ff9`fba3d030 mfc110u!CFrameWnd::OnCommand+0x8e

                                    54 00000000`005fedc0 00000000`44f28f80 mfc110u!CMDIFrameWnd::OnCommand+0x58

                                    55 00000000`005fee00 00007ff9`fba2591a sldappu!CMainFrame::ModifyDockingPane+0x19f0

                                    56 00000000`005fef10 00007ff9`fba25884 mfc110u!CWnd::OnWndMsg+0x62

                                    57 00000000`005ff080 00000000`44f38644 mfc110u!CWnd::WindowProc+0x38

                                    58 00000000`005ff0c0 00007ff9`fba2320a sldappu!CMainFrame::UserWantToStopCommand+0x9f4

                                    59 00000000`005ff180 00007ff9`fba235c4 mfc110u!AfxCallWndProc+0x162

                                    5a 00000000`005ff260 00007ff9`fb8db995 mfc110u!AfxWndProc+0x54

                                    5b 00000000`005ff2a0 00007ffa`3b07bc50 mfc110u!AfxWndProcBase+0x51

                                    5c 00000000`005ff2f0 00007ffa`3b07b94c USER32!UserCallWinProcCheckWow+0x280

                                    5d 00000000`005ff450 00007ffa`3b0911f3 USER32!DispatchClientMessage+0x9c

                                    5e 00000000`005ff4b0 00007ffa`3d5e90b4 USER32!_fnDWORD+0x33

                                    5f 00000000`005ff510 00007ffa`39c61164 ntdll!KiUserCallbackDispatcherContinue

                                    60 00000000`005ff598 00007ffa`3b07b060 win32u!NtUserMessageCall+0x14

                                    61 00000000`005ff5a0 00007ffa`3b07aee8 USER32!SendMessageWorker+0x120

                                    62 00000000`005ff630 00000000`450d79e8 USER32!SendMessageW+0xf8

                                    63 00000000`005ff690 00000000`450d533c sldappu!swCMButton::relayCommandToMainFrame+0xa8

                                    64 00000000`005ff6c0 00000000`450d4b10 sldappu!swCMButton::OnExecute+0x43c

                                    65 00000000`005ff750 00000000`450c24a0 sldappu!swCMButton::ClickButton+0x300

                                    66 00000000`005ff830 00007ff9`fba25e1b sldappu!CList<uiCmdHistoryItem,uiCmdHistoryItem>::NewNode+0xb30

                                    67 00000000`005ff860 00007ff9`fba25884 mfc110u!CWnd::OnWndMsg+0x563

                                    68 00000000`005ff9d0 00000000`450c6a40 mfc110u!CWnd::WindowProc+0x38

                                    69 00000000`005ffa10 00007ff9`fba2320a sldappu!swCMBar::SetAnalysisPreparationTabVisibility+0x560

                                    6a 00000000`005ffa90 00007ff9`fba235c4 mfc110u!AfxCallWndProc+0x162

                                    6b 00000000`005ffb70 00007ff9`fb8db995 mfc110u!AfxWndProc+0x54

                                    6c 00000000`005ffbb0 00007ffa`3b07bc50 mfc110u!AfxWndProcBase+0x51

                                    6d 00000000`005ffc00 00007ffa`3b07b5cf USER32!UserCallWinProcCheckWow+0x280

                                    6e 00000000`005ffd60 00000001`40008390 USER32!DispatchMessageWorker+0x19f

                                    6f 00000000`005ffde0 00000000`44d5dcaa sldworks+0x8390

                                    70 00000000`005ffe50 00000000`44d6e430 sldappu!CAmApp::AddURLToRecentFileList+0xfea

                                    71 00000000`005ffea0 00007ff9`fba3cf4a sldappu!CAmApp::Run+0x90

                                    72 00000000`005ffee0 00000001`4000c6ae mfc110u!AfxWinMain+0xa6

                                    73 00000000`005fff20 00007ffa`3af62774 sldworks+0xc6ae

                                    74 00000000`005fff60 00007ffa`3d5b0d61 KERNEL32!BaseThreadInitThunk+0x14

                                    75 00000000`005fff90 00000000`00000000 ntdll!RtlUserThreadStart+0x21

                          • Re: SolidWorks crash without exception - .NET Add-In
                            Christian Chu

                            it's hard to say without seeing your code, just guessing

                            I guess, SW is not crashing ... but the addin is hang such as infinite loop and waiting  for  a break which you can't access to SW

                            • Re: SolidWorks crash without exception - .NET Add-In
                              Jacob Corder

                              a few things to try

                                   is it happening on your computer, or all computers?

                                   if just yours,

                                        Run Cmd prompt as administrator

                                        type in SFC /Scannow

                                        i have had stupid things being fixed with this.

                                      

                                   Repair your solidworks installation

                               

                                   Make sure you are using the correct solidworks Dlls.

                              • Re: SolidWorks crash without exception - .NET Add-In
                                Andrew Johnson

                                It turns out that an SPR exists for this issue (995211). Heap can become corrupted when calling the CustomPropertyManager.Get5 method from an assembly that is loaded using late binding. This is true in my case. It appears to be fixed in SW2018. Tested with the 2018 Beta using the same file and the crash does not occur.

                                 

                                Thanks to everyone for the suggestions.