MahApps / MahApps.Metro

A framework that allows developers to cobble together a better UI for their own WPF applications with minimal effort.
https://mahapps.com
MIT License
9.32k stars 2.45k forks source link

ShowModalMessageExternal problem with PowerShell #4101

Open SirConfigMgr opened 3 years ago

SirConfigMgr commented 3 years ago

Describe the bug

I´m using Powershell with MahApps to display a GUI for the PS script. After migrating from version 1.6.5 to 2.4.5, the display of dialogs no longer works. I get an exception with

"The calling thread cannot access this object because the object is owned by another thread."

Steps to reproduce

A description of how to trigger this bug.

  1. Klick button
  2. Dialog should be displayed
  3. Powershell crashes

Github repository: https://github.com/SirConfigMgr/InplaceNotification UserInfo.ps1 in Line 459

Expected behavior

Dialog should be displayed

Actual behavior

Powershell crashes

Environment

MahApps.Metro version: v2.4.5
Windows build number: Win10 1909 [Version 10.0.18363.836]
Visual Studio: 2019 16.6.0
Target Framework: .Net Core 3.1 (v4.5.2, v4.7.2)
pschwab1 commented 2 years ago

Still having this issue in version 2.4.9 and with PowerShell 7.0.

KG-droid commented 2 years ago

I'm having this issue to, oddly only when run via the powershell ISE though.