Crash from System.ComponentModel.Win32Exception

Hi there,

I just want to let you know that since the first Rhino 8 release until today, this exception is repeated quite frequently.

No matter what the user is doing, sometimes the program is in idle and it’s thrown, others at opening time, moving toolbars/panels or just running commands during or after the execution.

The source methods in the call stack vary, but it always ends here:

System.ComponentModel.Win32Exception (0x80004005): The parameter is incorrect
MS.Win32.UnsafeNativeMethods.GetWindowTextLength(HandleRef hWnd) in
MS.Win32.UnsafeNativeMethods.GetWindowTextNoThrow(HandleRef hWnd, StringBuilder lpString, Int32 nMaxCount)

Here an example running the _Options command:

The main problem is the Rhino crahses and closes, avoiding to save the work, and usually when it crashes at opening time, it crashes at stratup during the next 3 or 4 times, until it works again, but it changes the ui distribution.

I also relaized that when it gets stuck crahing at stratup, if you delete manually the containers.xml file (default or custom scheme) it usally doesn’t crash at next startup.

As far as I see it’s related to the new panel/toolbar system, but I cannot assert it, it’s just my impresion.

I would appreciate if you please can take look to that, so it’s a pain for the users of my plugin, they loose their work frequently, even with the autobackup set to 2 min if it gets stuck at opening time there is no way top open it… and obviously they blame us, maybe it’s our mistake, but I have no clue about how to fix it.

Here two full call stack examples:

[ERROR] FATAL UNHANDLED EXCEPTION: System.ComponentModel.Win32Exception (0x80004005): The parameter is incorrect
   en MS.Win32.UnsafeNativeMethods.GetWindowTextLength(HandleRef hWnd)
   en MS.Win32.UnsafeNativeMethods.GetWindowTextNoThrow(HandleRef hWnd, StringBuilder lpString, Int32 nMaxCount)
   in System.Windows.Automation.Peers.WindowAutomationPeer.GetNameCore()
   in System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   in System.Windows.ContextLayoutManager.fireAutomationEvents()
   in System.Windows.ContextLayoutManager.UpdateLayout()
   in System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   in System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   in System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   in System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   in System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   in System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
[END ERROR]
[ERROR] FATAL UNHANDLED EXCEPTION: System.ComponentModel.Win32Exception (0x80004005): The parameter is incorrect
   in MS.Win32.UnsafeNativeMethods.GetWindowTextLength(HandleRef hWnd)
   in MS.Win32.UnsafeNativeMethods.GetWindowTextNoThrow(HandleRef hWnd, StringBuilder lpString, Int32 nMaxCount)
   in System.Windows.Automation.Peers.WindowAutomationPeer.GetNameCore()
   in System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   in System.Windows.Automation.Peers.AutomationPeer.UpdatePeer(Object arg)
   in System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   in System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
[END ERROR]

Thanks for your time.
Kind Regards
Will

Hi @Harper,

If you disable CrossGems, do you still have the problem?

image

– Dale

No, it doesn’t, only when it’s enabled.
Actually CrossGems is the plugin that we are developing.

Best
Will

Hi @Harper,

Ah, that helps - thanks,

What SR of Rhino 8 do you have. .NET Core has a bug in GetWindowTextLength that I though we resolved recently.

Thanks,

– Dale

We’re using tha latest public one, SR6,
The plugin is made with .Net Framework 4.8

Hi @Harper,

Can you provide us a way of repeating this?

Thanks,

– Dale

Hi @dale

Did you receive the files to make it crash?

Best
Will

I did - I’m out of the office this week.

Thanks,

— Dale

Thank you Dale,
I will wait for you to come back for an update on the matter.

Best
Will