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

Strange "problem" occured during startup. Cannot cast 'System.String' to 'System.Int32' #37275

Open
beatsbury opened this issue Feb 4, 2025 · 2 comments
Labels
Issue-Bug Something isn't working Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Product-PowerToys Run Improved app launch PT Run (Win+R) Window

Comments

@beatsbury
Copy link

Microsoft PowerToys version

0.87.1.0

Installation method

WinGet

Running as admin

Yes

Area(s) with issue?

General

Steps to reproduce

Was just restarting my pc. PT initialized, threw cast error window at me, but started anyway.

This is the log file.

2025-02-04.txt

And this here is stack trace excerpt.

Version: 0.87.1.0
OS Version: Microsoft Windows NT 10.0.19045.0
IntPtr Length: 8
x64: True
Date: 04.02.2025 7:52:25
Exception:
System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Int32'.
   at PowerLauncher.Helper.ThemeExtensions.IsSystemDarkMode()
   at PowerLauncher.Helper.ThemeExtensions.GetCurrentTheme()
   at PowerLauncher.Helper.ThemeManager.UpdateTheme()
   at PowerLauncher.Helper.ThemeManager..ctor(PowerToysRunSettings settings, MainWindow mainWindow)
   at PowerLauncher.App.<>c__DisplayClass20_0.<OnStartup>b__0()
   at Wox.Infrastructure.Stopwatch.Normal(String message, Action action)
   at PowerLauncher.App.OnStartup(Object sender, StartupEventArgs e)
   at System.Windows.Application.<.ctor>b__1_0(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

✔️ Expected Behavior

I grew not to expect anything growing old.

❌ Actual Behavior

Strange error which didn't prevent PT to start up normally.

Other Software

No response

@beatsbury beatsbury added Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Feb 4, 2025
@Aaron-Junker Aaron-Junker added Product-PowerToys Run Improved app launch PT Run (Win+R) Window Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. labels Feb 4, 2025
@beatsbury
Copy link
Author

It is reproducible. Just stopped PT and started it again. Same error occured, and PT started succesfully despite the error.

@daverayment
Copy link
Contributor

@beatsbury I think I know what is causing this. If you're comfortable with opening up the Registry Editor, could you hit Windows Key, run the following in, and paste in a screenshot of what RegEdit shows you, please:

regedit "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize"

For example, mine looks like:

Image

(There's no need to change any settings if they don't match these.)

I wonder if your "AppsUseLightTheme" value is either a different type or an unexpected value (or is absent!). This is used to determine whether Dark Mode is active or not for applications.

Thank you!

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 Needs-Repro We can't figure out how to make this happen. Please help find a simplified repro. Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Product-PowerToys Run Improved app launch PT Run (Win+R) Window
Projects
Status: No status
Development

No branches or pull requests

3 participants