Malfunctioned `IStorable.Store` crashes Rhino

Put the following code in a Component's Store method. Add the component into document and remove it. Rhino will crash.

I think GrasshopperIO should catch all exceptions.

        public override void Store(IWriter writer)
        {
            base.Store(writer);
            throw new NullReferenceException();
        }
FATAL UNHANDLED EXCEPTION: System.NullReferenceException: 未将对象引用设置到对象的实例。
   在 PancakeForGh2.GhInterop.PancakeComponent.Store(IWriter writer)
   在 GrasshopperIO.DataBase.Chunk.GrasshopperIO.IWriter.Storable(Location location, IStorable value)
   在 Grasshopper.Undo.Actions.DeleteObjectAction..ctor(IDocumentObject obj)
   在 Grasshopper.Doc.DocumentMethods.DeleteSelection(ContentFilter filter)
   在 Grasshopper.UI.Canvas.Canvas.DeleteSelection()
   在 Grasshopper.UI.Canvas.Canvas.KeyDownHandler(Object sender, KeyEventArgs e)
   在 Eto.PropertyStore.TriggerEvent[T](Object key, Object sender, T args)
   在 Eto.Forms.Control.OnKeyDown(KeyEventArgs e)
   在 Eto.Forms.Control.Callback.OnKeyDown(Control widget, KeyEventArgs e)
   在 Eto.Wpf.Forms.WpfFrameworkElement`3.HandleKeyDown(Object sender, KeyEventArgs e) 位置 D:\BuildAgent\work\dujour\src4\DotNetSDK\Eto\src\Eto.Wpf\Forms\WpfFrameworkElement.cs:行号 760
   在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   在 System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   在 System.Windows.Input.InputManager.ProcessStagingArea()
   在 System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   在 System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   在 System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
   在 System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
   在 System.Windows.Interop.HwndKeyboardInputProvider.FilterMessage(IntPtr hwnd, WindowMessage message, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Eventually yes, but for the time being I want to find all the places where exceptions are thrown during serialisation.

2 Likes