Repository: PowerToys
Issue: PowerToys MWBHelper service crashed unexpectedly
Labels: Issue-Bug,Needs-Triage

### Microsoft PowerToys version

0.86.0

### Installation method

Microsoft Store

### Running as admin

Yes

### Area(s) with issue?

Mouse Without Borders

### Steps to reproduce

This one is difficult to reproduce because it requires specific circumstances that don't seem easy to reproduce.  I'm of course just saying that because hopefully it'll jinx the bug and I'll be able to reproduce it once more.  Basically, I forgot to enable MWB as a service because I forgot to check that box in Settings for this PC - I had just set it up yesterday to run in sync with my two other PC's.  Did that have something to do with it?  Maybe.  But, I also found that these errors in the Event Viewer were very specific and could be used to trace this bug, even if I don't know yet how to reproduce it.

For both PowerToysSettings.exe and MWBHelper.exe, the Windows Application Event Log showed two Information level event with ID 1001, immediately followed by an error that displayed event ID 1002 with the Hanging Events task category.  Since the 1001 information events are a little big,  I attached those four reports as text files.  But, here is what the 1002 error looked like:

```
The program PowerToys.MouseWithoutBordersHelper.exe version 0.86.0.0 stopped interacting with Windows and was closed. To see if more information about the problem is available, check the problem history in the Security and Maintenance control panel.
```

Similarly, PowerToys.Settings.exe also has a similar event in the same format as above, just with the different executable name.  Subsequently, the User Profile Service restarted immediately after with event ID 1531, and the Winlogon service had an Information level event with ID 6003 that said:

```
The winlogon notification subscriber <SessionEnv> was unavailable to handle a critical notification event.
```

Clearly, something happened with these applications specifically to cause them to crash this way, and according to the logs, something on the Kernel level crashed - though, it is unclear what exactly (shown in log 2).

The unusual thing about it was that PowerToys.Settings.exe was also one of the faulting application in the logs, and I believe the reason for that was because I tried opening the Settings pane as soon as MWBHelper crashed, which Windows notified me of, so I became aware of the crash and tried to see if the service was still functioning.

In fact, it seems AdancedPaste also crashed similarly right after PowerToys.Settings crashed with the faulting module named CoreMessagingXP.dll, which makes this potentially a cascading failure.  It's important to note, though, that AdvancedPaste crashed, whereas the previous two applications were Hanging Events.  Both the PowerToysSettings and MWBHelper executables were ghost processes on my machine and couldn't be stopped even by running an administrative terminate call via WMIC.

I've learned just enough from this bug that, if I was able to reproduce it, I could attach to the process with WinDbg and find the faulting kernel handle/thread/etc..    I would be curious to find it and see which one it is.



### ✔️ Expected Behavior

Nothing to crash or hang

### ❌ Actual Behavior

[WER log 0.txt](https://github.com/user-attachments/files/17816714/WER.log.0.txt)
[WER log 1.txt](https://github.com/user-attachments/files/17816765/WER.log.1.txt)
[WER log 2.txt](https://github.com/user-attachments/files/17816766/WER.log.2.txt)
[WER log 3.txt](https://github.com/user-attachments/files/17816715/WER.log.3.txt)


### Other Software

_No response_