MainWindowHandle errors when using ShowSemiModal for WPF

Hi,
In the sample project, where ShowSemiModal for WPF is used, MainWindowHandle gives the following error.

System.ComponentModel.Win32Exception: "Invalid window handle"

If you execute a command with a button while SemiModal is displayed, SemiModal will be closed forcibly. Then, when the “SampleCsWpfSemiModalDialog” command is executed again, an error occurs and the modal is not displayed.

The same phenomenon did not occur with SemiModal for Windows.Form. I checked with the sample “SampleCsSemiModalForm”.

Thank you if someone knows what is happening.

Hi @fujihira,

I am not able to repeat what you’re reporting. Can you run Rhino’s SystemInfo command and post your results? What version of Visual Studio are you using?

– Dale

Hi @dale ,

Thank you for your time.

Below are the results of the SystemInfo command.

Rhino 7 SR30 2023-6-12 (Rhino 7, 7.30.23163.13001, Git hash:master @ f695e494df78377a81b2b95edb99c6067e324b33)
License type: 商用版、ビルド 2023-06-12
License details: Cloud Zoo

Windows 11 (10.0.22621 SR0.0) or greater (Physical RAM: 64Gb)

Computer platform: DESKTOP 

Standard graphics configuration.
  Primary display and OpenGL: NVIDIA GeForce GTX 1080 Ti (NVidia) Memory: 11GB, Driver date: 5-24-2023 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 535.98
    > Accelerated graphics device with 4 adapter port(s)
        - Secondary monitor attached to adapter port #0
        - Windows Main Display attached to adapter port #1

OpenGL Settings
  Safe mode: Off
  Use accelerated hardware modes: On
  Redraw scene when viewports are exposed: On
  Graphics level being used: OpenGL 4.6 (primary GPU's maximum)
  
  Anti-alias mode: 4x
  Mip Map Filtering: Linear
  Anisotropic Filtering Mode: High
  
  Vendor Name: NVIDIA Corporation
  Render version: 4.6
  Shading Language: 4.60 NVIDIA
  Driver Date: 5-24-2023
  Driver Version: 31.0.15.3598
  Maximum Texture size: 32768 x 32768
  Z-Buffer depth: 24 bits
  Maximum Viewport size: 32768 x 32768
  Total Video Memory: 11 GB

Rhino plugins that do not ship with Rhino
  C:\work\0001_code\rhino-developer-samples-7\rhinocommon\cs\bin\SampleCsWizardPanel.rhp	"SampleCsWizardPanel"	6.0.0.0
  C:\work\0001_code\rhino-developer-samples-7\rhinocommon\cs\bin\SampleCsWpf.rhp	"SampleCsWpf"	6.0.0.0

Rhino plugins that ship with Rhino
  C:\Program Files\Rhino 7\Plug-ins\Commands.rhp	"Commands"	7.30.23163.13001
  C:\Program Files\Rhino 7\Plug-ins\rdk.rhp	"Renderer Development Kit"	
  C:\Program Files\Rhino 7\Plug-ins\RhinoRenderCycles.rhp	"Rhinoレンダー"	7.30.23163.13001
  C:\Program Files\Rhino 7\Plug-ins\rdk_etoui.rhp	"RDK_EtoUI"	7.30.23163.13001
  C:\Program Files\Rhino 7\Plug-ins\rdk_ui.rhp	"Renderer Development Kit UI"	
  C:\Program Files\Rhino 7\Plug-ins\NamedSnapshots.rhp	"Snapshots"	
  C:\Program Files\Rhino 7\Plug-ins\RhinoCycles.rhp	"RhinoCycles"	7.30.23163.13001
  C:\Program Files\Rhino 7\Plug-ins\Toolbars\Toolbars.rhp	"Toolbars"	7.30.23163.13001
  C:\Program Files\Rhino 7\Plug-ins\3dxrhino.rhp	"3Dconnexion 3D Mouse"	
  C:\Program Files\Rhino 7\Plug-ins\Displacement.rhp	"Displacement"	


Below is the version of VisualStudio.

Microsoft Visual Studio Community 2019
Version 16.11.26

I will also post a video reproducing the error.

Thanks.