Visual Scripting - Crash Replacing Out Param
NOTE: Please read my second comment below before investigating this bug.
This crash is reproducible on my system but only with this script and with this name. If I copy the script and rename it then the crash doesn't happen with the copy.
Steps to reproduce
- open the script
- add a new parameter to the Output node
- remove the parameter again by double clicking it
- now add the parameter again
- VST crashes when the parameter is created
The stack trace is:
2020-08-05 11:52:17.336 - Thread: 1 -> Error: System.NullReferenceException: Object reference not set to an instance of an object.
at GraphWPF.NodeConnector.<get_Connections>d__28.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at VisualScriptingPlugin.Utils.VisualScriptingTools.Clear(NodeConnector connector, GraphControlWPF graph)
at VisualScriptingPlugin.Nodes.MyScriptNodeScriptInteraction.ReloadSignature(Boolean init)
at VisualScriptingPlugin.Nodes.MyInteractionHandler.ScriptSignatureChanged()
at VisualScriptingPlugin.Nodes.MyScriptNodeOutputInteraction.AddParam(String name, Type type)
at VisualScriptingPlugin.Nodes.MyScriptNodeOutputInteraction.AddParamButtonOnDoubleClicked(Object o, NodeItemEventArgs nodeItemEventArgs)
at GraphWPF.NodeItem.OnDoubleClick(Point& cursorTransformedLocation)
at GraphWPF.GraphControlWPF.OnMouseDoubleClick(MouseButtonEventArgs e)
at System.Windows.Controls.Control.HandleDoubleClick(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at VRageEditor.VRageEditor.OnTick()
at Sandbox.Engine.Platform.FixedLoop.<>c__DisplayClass11_0.<Run>b__0()
at Sandbox.Engine.Platform.GenericLoop.Run(VoidAction tickCallback)
at VRageEditor.VRageEditor.Run()
2020-08-05 11:52:19.329 - Thread: 1 -> Error: System.NullReferenceException: Object reference not set to an instance of an object.
at GraphWPF.NodeConnector.<get_Connections>d__28.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at VisualScriptingPlugin.Utils.VisualScriptingTools.Clear(NodeConnector connector, GraphControlWPF graph)
at VisualScriptingPlugin.Nodes.MyScriptNodeScriptInteraction.ReloadSignature(Boolean init)
at VisualScriptingPlugin.Nodes.MyInteractionHandler.ScriptSignatureChanged()
at VisualScriptingPlugin.Nodes.MyScriptNodeOutputInteraction.AddParam(String name, Type type)
at VisualScriptingPlugin.Nodes.MyScriptNodeOutputInteraction.AddParamButtonOnDoubleClicked(Object o, NodeItemEventArgs nodeItemEventArgs)
at GraphWPF.NodeItem.OnDoubleClick(Point& cursorTransformedLocation)
at GraphWPF.GraphControlWPF.OnMouseDoubleClick(MouseButtonEventArgs e)
at System.Windows.Controls.Control.HandleDoubleClick(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs ar
It turns out that I'd copied this script in the past to illustrate other bugs. Editing Bug_SimpleScript was also editing those other scripts. I guess this is because the IDs are not unique. If I remove the scripts that were based on Bug_SimpleScript then this crash doesn't happen any more.
You could argue that this isn't a bug. However, VST should probably protect itself against people copying scripts like this if it's not safe to do so. For example, it could check for scripts that clash while it's loading them and then refuse to load the second script.
It would be nice to be able to clone scripts with the UI. That way, VST could make sure that all the IDs are unique.
It turns out that I'd copied this script in the past to illustrate other bugs. Editing Bug_SimpleScript was also editing those other scripts. I guess this is because the IDs are not unique. If I remove the scripts that were based on Bug_SimpleScript then this crash doesn't happen any more.
You could argue that this isn't a bug. However, VST should probably protect itself against people copying scripts like this if it's not safe to do so. For example, it could check for scripts that clash while it's loading them and then refuse to load the second script.
It would be nice to be able to clone scripts with the UI. That way, VST could make sure that all the IDs are unique.
Hello, Engineer!
Already fixed in v197.
Kind Regards
Keen Software House: QA Department
Hello, Engineer!
Already fixed in v197.
Kind Regards
Keen Software House: QA Department
Replies have been locked on this page!