Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot launch UI elements: faulting module Microsoft.UI.Xaml.dll #36028

Closed
tomudding opened this issue Nov 20, 2024 · 19 comments
Closed

Cannot launch UI elements: faulting module Microsoft.UI.Xaml.dll #36028

tomudding opened this issue Nov 20, 2024 · 19 comments
Labels
Issue-Bug Something isn't working Resolution-Already Fixed/Doesn't Apply A change in the product has made the issue obsolete.

Comments

@tomudding
Copy link

tomudding commented Nov 20, 2024

Microsoft PowerToys version

0.86.0

Installation method

GitHub

Running as admin

No

Area(s) with issue?

General, Settings, Advanced Paste, PowerToys Run

Steps to reproduce

Installed 0.86.0 (machine-wide) from GitHub on W11 23H2 22631 (multiple machines), both manually and through SCCM.

I get the following error when trying to launch any UI part of PowerToys:

Faulting application name: PowerToys.PowerLauncher.exe, version: 0.86.0.0, time stamp: 0x66e80000
Faulting module name: KERNELBASE.dll, version: 10.0.22621.4391, time stamp: 0x7433a115
Exception code: 0xe0434352
Fault offset: 0x000000000005fa4c
Faulting process ID: 0x0xbb0
Faulting application start time: 0x0x1db3b83c903a38c
Faulting application path: C:\Program Files\PowerToys\PowerToys.PowerLauncher.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Faulting application name: PowerToys.Settings.exe, version: 0.86.0.0, time stamp: 0x66e80000
Faulting module name: Microsoft.UI.Xaml.dll, version: 3.1.6.0, time stamp: 0x0caad657
Exception code: 0xc000027b
Fault offset: 0x0000000000009125
Faulting process ID: 0x0xf24
Faulting application start time: 0x0x1db3b83caefa763
Faulting application path: C:\Program Files\PowerToys\WinUI3Apps\PowerToys.Settings.exe
Faulting module path: C:\Program Files\PowerToys\WinUI3Apps\Microsoft.UI.Xaml.dll
Faulting application name: PowerToys.Peek.UI.exe, version: 0.86.0.0, time stamp: 0x66e80000
Faulting module name: Microsoft.UI.Xaml.dll, version: 3.1.6.0, time stamp: 0x0caad657
Exception code: 0xc000027b
Fault offset: 0x0000000000009125
Faulting process ID: 0x0x1b20
Faulting application start time: 0x0x1db3b84ec20d9a2
Faulting application path: C:\Program Files\PowerToys\WinUI3Apps\PowerToys.Peek.UI.exe
Faulting module path: C:\Program Files\PowerToys\WinUI3Apps\Microsoft.UI.Xaml.dll

Trying to generate a debug report results in (likely because diagnostics is disabled through GPO):

Application: PowerToys.PowerLauncher.exe
CoreCLR Version: 8.0.1024.46610
.NET Version: 8.0.10
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidCastException: Unable to cast object of type 'System.Byte[]' to type 'System.Int32'.
   at Microsoft.PowerToys.Telemetry.DataDiagnosticsSettings.GetEnabledValue()
   at Microsoft.PowerToys.Telemetry.ETWTrace..ctor()
   at PowerLauncher.App..ctor()
   at PowerLauncher.App.Main()

✔️ Expected Behavior

Any UI element of PowerToys opens as expected.

❌ Actual Behavior

Nothing opens (the icon is visible in the system tray), and occasionally, the system hangs (especially when trying to do something with advanced paste).

Interestingly, Always On Top works perfectly. Running the application as an administrator also works perfectly (no GPO enforced).

Other Software

No response

@tomudding tomudding added Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Nov 20, 2024
@Zagrthos
Copy link

I can confirm this behavior. It's still present in 0.87.0.

We're installing PowerToys with the System-Wide Installer (extracting the MSI beforehand with Wix Toolset) and then just let it run via default settings. Issue also occurs with GPOs set.

Logs in EventViewer

PowerToys Run:

Application: PowerToys.PowerLauncher.exe
CoreCLR Version: 9.0.24.52809
.NET Version: 9.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidCastException: Unable to cast object of type 'System.Byte[]' to type 'System.Int32'.
   at Microsoft.PowerToys.Telemetry.DataDiagnosticsSettings.GetEnabledValue()
   at Microsoft.PowerToys.Telemetry.ETWTrace..ctor()
   at PowerLauncher.App..ctor()
   at PowerLauncher.App.Main()

Name der fehlerhaften Anwendung: PowerToys.PowerLauncher.exe, Version: 0.87.0.0, Zeitstempel: 0x67200000
Name des fehlerhaften Moduls: KERNELBASE.dll, Version: 10.0.22621.4391, Zeitstempel: 0x7433a115
Ausnahmecode: 0xe0434352
Fehleroffset: 0x000000000005fa4c
ID des fehlerhaften Prozesses: 0x0x479C
Startzeit der fehlerhaften Anwendung: 0x0x1DB506F2C8C48DD
Pfad der fehlerhaften Anwendung: C:\Program Files\PowerToys\PowerToys.PowerLauncher.exe
Pfad des fehlerhaften Moduls: C:\WINDOWS\System32\KERNELBASE.dll
Berichtskennung: f2e7a108-7ff2-4d92-9dd8-34a18363fa15
Vollständiger Name des fehlerhaften Pakets: 
Anwendungs-ID, die relativ zum fehlerhaften Paket ist: 

PowerToys Settings

Name der fehlerhaften Anwendung: PowerToys.Settings.exe, Version: 0.87.0.0, Zeitstempel: 0x67200000
Name des fehlerhaften Moduls: Microsoft.UI.Xaml.dll, Version: 3.1.6.0, Zeitstempel: 0xe09b717f
Ausnahmecode: 0xc000027b
Fehleroffset: 0x0000000000009125
ID des fehlerhaften Prozesses: 0x0x4F00
Startzeit der fehlerhaften Anwendung: 0x0x1DB506F3362D2A4
Pfad der fehlerhaften Anwendung: C:\Program Files\PowerToys\WinUI3Apps\PowerToys.Settings.exe
Pfad des fehlerhaften Moduls: C:\Program Files\PowerToys\WinUI3Apps\Microsoft.UI.Xaml.dll
Berichtskennung: 42022e85-5e62-4e1a-b80f-4612eb96dd8e
Vollständiger Name des fehlerhaften Pakets: 
Anwendungs-ID, die relativ zum fehlerhaften Paket ist: 

Color Picker

[11:33:55.7445180] [Info] Program::Main
    Color Picker started with pid=20732
[11:33:55.7825034] [Error] Program::Main
    Unhandled exception
System.InvalidCastException: Unable to cast object of type 'System.Byte[]' to type 'System.Int32'.
Stack trace: 
   at Microsoft.PowerToys.Telemetry.DataDiagnosticsSettings.GetEnabledValue()
   at Microsoft.PowerToys.Telemetry.ETWTrace..ctor()
   at ColorPickerUI.App..ctor()
   at ColorPicker.Program.Main(String[] args)
[11:33:55.7896816] [Info] CursorManager::ChangeCursor
    Cursor file path was null
[11:33:55.7898266] [Info] CursorManager::ChangeCursor
    Cursor file path was null

@tomudding
Copy link
Author

Can confirm that we also still have the issue on 0.87.0.

@Zagrthos
Copy link

Zagrthos commented Dec 20, 2024

I tested out every PowerToys Version down from the current one and the issues do not occur on versions prior 0.85.1 (that one is also not affected). I suppose it was introduced with the addition of customizable telemetry.

@CatGamer23
Copy link

CatGamer23 commented Jan 17, 2025

I think I have found the fix for this, but I need someone to replicate this:

  1. Go to regedit, and go to Computer\HKEY_CLASSES_ROOT\PowerToys
  2. There should be a invalid REG_QWORD AllowDataDiagnostics Delete it.
  3. Try to open PowerToys (It will re-appear corrupted again upon restarting PowerToys)

It seems whatever is creating the registry entry is incorrectly doing so, with either the wrong type or wrong data.

@tomudding
Copy link
Author

I think I have found the fix for this, but I need someone to replicate this:

1. Go to regedit, and go to `Computer\HKEY_CLASSES_ROOT\PowerToys`

2. There should be a invalid REG_QWORD `AllowDataDiagnostics` Delete it.

3. Try to open PowerToys (It will re-appear corrupted again upon restarting PowerToys)

It seems whatever is creating the registry entry is incorrectly doing so, wither the wrong type or wrong data.

Thank you for these steps! Our systems are currently down, so I am unable to test this, but I will report back early next week.

@Zagrthos
Copy link

Zagrthos commented Jan 17, 2025

I think I have found the fix for this, but I need someone to replicate this:

1. Go to regedit, and go to `Computer\HKEY_CLASSES_ROOT\PowerToys`

2. There should be a invalid REG_QWORD `AllowDataDiagnostics` Delete it.

3. Try to open PowerToys (It will re-appear corrupted again upon restarting PowerToys)

It seems whatever is creating the registry entry is incorrectly doing so, with either the wrong type or wrong data.

Thanks, gonna test that out on monday when I am back at work. Can't replicate this at home...

Edit:
Actually no, I am dumb. This is local...
But doesn't work. PowerToys.PowerLauncher still crashes upon start, same for PowerToys.Settings.
Same error messages as before.

@CatGamer23
Copy link

Is it the same errors @Zagrthos? If not, can you post your logs? (Right click tray icon -> Report Bug)

@Zagrthos
Copy link

Same error, here you go:
PowerToysReport_2025-01-17-22-35-02.zip

@CatGamer23
Copy link

Oh, it just occurred to me, but I uninstalled/reinstalled PowerToys before I tried this. Though, I doubt reinstalling changes anything.

@CatGamer23
Copy link

Also, while checking the bug report, I noticed that the corrupted registry entry was still there.

@Stareddy
Copy link

Ahoi hoi,
sorry for my bad English.

We have/had the same Problem.

We are using GroupPolicies to activate/deactivate PowerToys functions. We also deactivated "Allow sending diagnistic data".

After the Policy was set and PowerToys in Version 0.86.0 or higher is started, there will be a RegKey generated as written by CatGamer23.

If Policy is set under UseContext -> HKCU\Software\Classes\PowerToys -> Key AllowDataDiagnostics with corrupted Data.

Only if we activate oder Remove "Allow sending diagnistic data" in Policies and remove the "HKCU\Software\Classes\PowerToys" RegKey, the PowerToys Settings are starting again.

Only deactivating the Policy does not work, because the "HKCU\Software\Classes\PowerToys" is still set. Even if you remove PowerToys. The RegKey is still there.

I hope i was able to help someone.

Thank to CatGamer23 to show me the way to find a solution ;-)

@CatGamer23
Copy link

CatGamer23 commented Jan 20, 2025

I didn't quite understand, but I just want to clarify: You had same/similar problem, and fixed it by not just deleting the AllowDataDiagnostics value, but the PowerToys key above it? (Sorry if this comes off as mean, not my intent)

@Stareddy
Copy link

Everything is fine ;-)

Jup we hat the same Problems. PowerToys was not starting (Settings).

We removed(not configured) "Allow sending diagnistic data" Policy and we had to remove the RegKey. Only removing (not configuring) the Policy brought no solution.

Yes we removed the whole RegistryKey but it also worked if we only Remove the RegKeyValue -> AllowDataDiagnostics

The RegKey "HKEY_CURRENT_USER\Software\Classes\PowerToys" is only set, if the Policy "Allow sending diagnistic data" is set to "deactivate".

If you set "Allow sending diagnistic data" to activate or does not set (configure) the Policy. The RegKey is not set.

But as said we are using UsePolicy to configure PowerToys.

@CatGamer23
Copy link

CatGamer23 commented Jan 20, 2025

While I don't know what UsePolicy (I assume its like Microsoft's GroupPolicy, but 3rd-party, like PolicyPlus) is, I didn't know the key HKEY_CURRENT_USER\Software\Classes\PowerToys existed, which was why I got confused. I just checked for myself, its also corrupt for me too.

Here is my current hypothesis: when writing the data the the registry, it uses a variable of some sort (int, bool, maybe even a string) which is supposed to be filtered/converted to a registry-safe format, but somehow it either misses this step, or has erroneous data, which corrupts the registry.

TL;DR: Whoever implemented the disable telemetry via registry feature didn't do it right, and no one noticed.

(I don't really know C# well enough to read the source code, hopefully someone with the skillset can)

@Zagrthos
Copy link

I suppose the issue lies here at this line:

if (RegSetValueExW(key, DataDiagnosticsRegValueName, 0, REG_QWORD, reinterpret_cast<const BYTE*>(&value), buf_size) != ERROR_SUCCESS)

if (RegSetValueExW(key, DataDiagnosticsRegValueName, 0, REG_QWORD, reinterpret_cast<const BYTE*>(&value), buf_size) != ERROR_SUCCESS)

It saves the boolean value as a QWORD which doesn't sound right. Should be a DWORD.

@Zagrthos Zagrthos mentioned this issue Jan 22, 2025
11 tasks
@jaimecbernardo jaimecbernardo added this to the PowerToys 0.88 milestone Jan 22, 2025
@jaimecbernardo jaimecbernardo added Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Jan 22, 2025
@stefansjfw
Copy link
Collaborator

Fixed and should be release with upcoming PowerToys version

@stefansjfw
Copy link
Collaborator

Thank you all for details and investigation!

@CatGamer23
Copy link

Awesome! That awful bug is finally going to be fixed!

@Zagrthos
Copy link

Thanks! Hopefully that will fix it forever, this was a nightmare 🙂

@cinnamon-msft cinnamon-msft removed the Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. label Feb 4, 2025
@cinnamon-msft cinnamon-msft added the Resolution-Already Fixed/Doesn't Apply A change in the product has made the issue obsolete. label Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Something isn't working Resolution-Already Fixed/Doesn't Apply A change in the product has made the issue obsolete.
Projects
None yet
Development

No branches or pull requests

7 participants