[bug] Rhino.UI.Dialogs.ShowMessage shows two dialogs for one call

Claude believes there is a bug in Rhino causing duplicating dialog messages in Rhino 9 WIP 9.0.26244.12303, Windows 11:

"A single call to Rhino.UI.Dialogs.ShowMessage(…) puts up two message

windows instead of one: a dark Rhino-themed dialog, with a light

native-styled one stacked on top. Both carry the same text and buttons.

Dismissing one leaves the other on screen.

Call site:

var answer = Rhino.UI.Dialogs.ShowMessage(

    "some text",

    "some text",

    Rhino.UI.ShowMessageButton.YesNo,

    Rhino.UI.ShowMessageIcon.Question);

I hit this from a plugin, in a RhinoApp.Idle callback queued from

RhinoDoc.EndOpenDocument. I logged every layer above the call to rule out

my own code re-entering:

EndOpenDocument fired      1x  (merge=False, reference=False)

my event raised            1x  (1 subscriber)

prompt queued              1x

ShowMessage called         1x

dialogs on screen          2

So it is one invocation producing two windows.

Workaround: calling Eto.Forms.MessageBox.Show directly, owned by

RhinoEtoApp.MainWindowForOwner, shows exactly one dialog and picks up the

Rhino theme correctly."

Hi @Yury_Nasonov1,

Thanks for the detailed report, and for logging each layer of your code. That ruled out re-entrancy on your side.

Here’s what I think is happening. ShowMessage hands the message to Rhino’s themed (Eto) message box. If that themed box reports a failure, Rhino falls back to a native Windows message box. You’re seeing both, which means the themed box was shown, then something threw an exception while it was open, and Rhino treated that as a failure and showed the native box as well. The themed box is never closed on that path, so it stays behind the native one.

To fix the real cause I need to know what’s throwing. Could you add this before your ShowMessage call, reproduce the problem, and post what gets printed to the command line?

Rhino.Runtime.HostUtils.OnExceptionReport += (source, ex) =>
  Rhino.RhinoApp.WriteLine("ExceptionReport: {0}\n{1}", source, ex);

If you’d rather not change code, DebugView running alongside Rhino will also capture it.

In the meantime, calling Eto.Forms.MessageBox.Show with RhinoEtoApp.MainWindowForOwner as the owner, as you’re doing now, is a good workaround.

I’ll log this so the fallback can’t show a second dialog, whatever the underlying cause turns out to be.

Thanks,
— Dale

RH-99089 is fixed in Rhino BETA