When using SerialPort4 and no COM port is found vvvv doesn't exit correctly

… and the vvvv process (sometimes) keeps lingering. Debugging with VS yields the following exception:

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=VL.CoreLib
  StackTrace:
   at VL.Lib.IO.Ports.SerialPort4.ClosePort(Int32 timeout)
   at VL.Lib.IO.Ports.SerialPort4.Dispose()
   at VL.AppServices.CompilerServices.Intrinsics.CacheManager`2.Dispose(Object obj)
   at VL.AppServices.CompilerServices.Intrinsics.CacheManager`2.Dispose()
   at VL.AppServices.CompilationHelper.ShieldedDisposeForManagedFields(Object x)
   at _VL_CoreLib_IO_.IO.SerialPort4_C.__PKG4Ty8MrTbPciriU4EfbG.System.IDisposable.Dispose()
   at VL.AppServices.CompilerServices.CustomRegion.CustomRegionPatch.Dispose()
   at VL.Lib.Primitive.IDisposableUtils.TryDisposeInstance(Object input, Boolean& success)
   at VL.Lib.Primitive.IDisposableUtils.TryDispose(Object input, Boolean& success)
   at _CoreLibBasics_.Primitive.ManageProcess_KbnPKKIL8zRNfOzhFqxVxr.Dispose_()
   at _CoreLibBasics_.Primitive.ManageProcess_KbnPKKIL8zRNfOzhFqxVxr.System.IDisposable.Dispose()
   at VL.AppServices.CompilationHelper.ShieldedDisposeForManagedFields(Object x)
   at _VL_CoreLib_IO_.IO.SerialPort4_C.Dispose_()
   at _VL_CoreLib_IO_.IO.SerialPort4_C.System.IDisposable.Dispose()
   at VL.AppServices.CompilationHelper.ShieldedDisposeForManagedFields(Object x)
   at _SerialPort4_.__auto.SerialPort4Application_F7e9gj5XFh3NURGemIPUzOProgram_.__State.System.IDisposable.Dispose() in D:\Downloads\SerialPort4.vl.cs:line 102

image

Tested with 5.2

any exact steps to reproduce?

  • Open the patch.
  • (make sure no COM port is available/found)
  • Attach the VS debugger
  • Close vvvv (Alt + F4)

SerialPort4.vl (4.0 KB)