Calling MessageBox.Show() from COM .NET library from Ruby closes SketchUp

Hi all,

We are writing an extension on Ruby for SketchUp 2015 x64. This extension will work with our COM object. The COM object is .NET library.

.NET simply calls Windows Forms


but this lines closes SketchUp. While debugging I get next exception message

Exception of type 'System.ExecutionEngineException' was thrown.

and SketchUp is closed. If I call the same method as COM object from .NET simple console application all works fine.

Have you met with this kind issues before? Maybe you know a better way to call .NET functions from Ruby extension.

Any help is appreciated.

Best regards, Vladimir

You can use the Ruby wrapper for the system messagebox function:
[url]Homepage | SketchUp Developer

msg = "Some text message we display to user."
UI.messagebox( msg, MB_OK )

Hi Vladimir,

You need to call the MessageBox.Show(); within another thread.
for example:

        Dispatcher dispatcher = Dispatcher.CurrentDispatcher;

        Thread thread = new Thread(() =>
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            lock (windowLock)
                _mainWpf = new SODMainWindow(this, dispatcher);

            _mainWpf.Closed += (sender2, e2) =>