SmcCenter crashes when updating firmware on 24v23

I’m attempting to upgrade the firmware on a 24v23 and the SmcCenter reliably crashes while doing so. The full trace dumped is below.
Annoyingly, I can’t seem to find any way to get the controller out of boot mode without updating the firmware, I can’t seem to find any way to update the firmware without using SmcCenter, and I can’t find any way to get SmcCenter to actually update the firmware!

Power cycling the controller doesn’t help: It remains in boot mode.

Any ideas on where to go from here would be most welcome.

smc_linux$ ./SmcCenter 
System.ArgumentException: A null reference or invalid value was found [GDI+ status: InvalidParameter]
  at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in <filename unknown>:0 
  at System.Drawing.Region.Exclude (Rectangle rect) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.Region:Exclude (System.Drawing.Rectangle)
  at System.Windows.Forms.Control+DoubleBuffer.End (System.Windows.Forms.PaintEventArgs pe) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0 

Unhandled Exception: System.InvalidOperationException: Cannot call Invoke or BeginInvoke on a control until the window handle is created
  at System.Windows.Forms.Control.FindControlToInvokeOn () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.BeginInvokeInternal (System.Delegate method, System.Object[] args) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.BeginInvoke (System.Delegate method) [0x00000] in <filename unknown>:0 
  at Pololu.SimpleMotorController.SmcConfigurationUtility.MainWindow.backgroundUpdateStatus () [0x00000] in <filename unknown>:0 
  at System.Threading.Thread.StartInternal () [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: Cannot call Invoke or BeginInvoke on a control until the window handle is created
  at System.Windows.Forms.Control.FindControlToInvokeOn () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.BeginInvokeInternal (System.Delegate method, System.Object[] args) [0x00000] in <filename unknown>:0

smc_linux$ ./SmcCenter 
System.ArgumentException: A null reference or invalid value was found [GDI+ status: InvalidParameter]
  at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in <filename unknown>:0 
  at System.Drawing.Region.Exclude (Rectangle rect) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.Region:Exclude (System.Drawing.Rectangle)
  at System.Windows.Forms.Control+DoubleBuffer.End (System.Windows.Forms.PaintEventArgs pe) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0 

Unhandled Exception: System.InvalidOperationException: Cannot call Invoke or BeginInvoke on a control until the window handle is created
  at System.Windows.Forms.Control.FindControlToInvokeOn () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.BeginInvokeInternal (System.Delegate method, System.Object[] args) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.BeginInvoke (System.Delegate method) [0x00000] in <filename unknown>:0 
  at Pololu.SimpleMotorController.SmcConfigurationUtility.MainWindow.backgroundUpdateStatus () [0x00000] in <filename unknown>:0 
  at System.Threading.Thread.StartInternal () [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: Cannot call Invoke or BeginInvoke on a control until the window handle is created
  at System.Windows.Forms.Control.FindControlToInvokeOn () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.BeginInvokeInternal (System.Delegate method, System.Object[] args) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.BeginInvoke (System.Delegate method) [0x00000] in <filename unknown>:0 
  at Pololu.SimpleMotorController.SmcConfigurationUtility.MainWindow.backgroundUpdateStatus () [0x00000] in <filename unknown>:0 
  at System.Threading.Thread.StartInternal () [0x00000] in <filename unknown>:0 

  at System.Windows.Forms.Control.BeginInvoke (System.Delegate method) [0x00000] in <filename unknown>:0 
  at Pololu.SimpleMotorController.SmcConfigurationUtility.MainWindow.backgroundUpdateStatus () [0x00000] in <filename unknown>:0 
  at System.Threading.Thread.StartInternal () [0x00000] in <filename unknown>:0

Hello.

I am sorry you are having trouble with the Simple Motor Controller. I was able to reproduce the problem here and will be trying to find a workaround tomorrow. In the meantime, if you have a Windows computer that can run our software, then then that would be quickest way to update the firmware and get your device working again.

–David

Were you able to find a Windows computer to load the firmware back onto your Simple Motor Controller? Unfortunately, the problem you are having seems to be a new error caused by mono’s implementation of Windows Forms. While we might implement a workaround for Linux at some point, our current recommendation is that you find a Windows computer in the rare case where a firmware upgrade is required. We have added a warning to the “Upgrading Firmware” section of the Simple Motor Controller User’s Guide. Sorry for the inconvenience, and thank you for letting us know about the problem.

–David

I didn’t have a windows computer to hand, but I worked around the problem by disassembling the software, adding a try{} catch{} block around the offending code, re-assembling and running it.

This worked well enough for the firmware update to finish, and the controller returned from boot mode.

FWIW: I added .try{ … } catch class [mscorlib]System.Exception { } to MainWindow::backgroundUpdateDeviceList and MainWindow::backgroundUpdateStatus around the form handling. [ Actually, around everything inside the loops except the call to System.Threading.Thread::Sleep() ]

(I don’t actually know C# at all, so forgive me if the try{} catch{} syntax above isn’t right: It’s just the form in which I added it to the mono disassembly)