MahApps / MahApps/MahApps.Metro

ShowModalMessageExternal problem with PowerShell

Open
#4,101 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
C#
Stars
9.8k
Forks
2.4k
Avg merge
1h 2m
Merged PRs (30d)
56

Description

## 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)
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the external repository's UserInfo.ps1 at line 459 and reproduce the dialog flow described: click the button and observe the thread-access exception under MahApps.Metro 2.4.5. Compare the behavior with version 1.6.5 and identify the relevant dialog entry point; done means the PowerShell dialog displays without crashing.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.