microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
110.22k stars 6.49k forks source link

[Critical BUG ?] [PT Run] Crash on opening the window #33504

Open htcfreek opened 3 months ago

htcfreek commented 3 months ago

Microsoft PowerToys version

latest main (Commit: 5c257fb3db7f60cc8f38e5f2019d6b81dc262fa7)

Installation method

Dev build in Visual Studio

Running as admin

None

Area(s) with issue?

PowerToys Run

Steps to reproduce

PowerLauncher crashes on opening the Window.

It happens on debug and release builds. And it seems to happen on Windows 10 and Windows 11.

image

image

Version: 0.0.1.0
OS Version: Microsoft Windows NT 10.0.19045.0
IntPtr Length: 8
x64: True
Date: 25.06.2024 16:08:14
Exception:
System.ArgumentException: Value does not fall within the expected range.
   at Wox.Plugin.Common.Win32.NativeMethods.DwmSetWindowAttribute(IntPtr hwnd, Int32 attr, UInt32& attrValue, Int32 attrSize)
   at PowerLauncher.ViewModel.MainViewModel.ToggleWox() in D:\AppDev\Github\PT_ValHelp\src\modules\launcher\PowerLauncher\ViewModel\MainViewModel.cs:line 1035
   at PowerLauncher.ViewModel.MainViewModel.<OnHotkey>b__147_0() in D:\AppDev\Github\PT_ValHelp\src\modules\launcher\PowerLauncher\ViewModel\MainViewModel.cs:line 1001
   at System.Windows.Threading.Dispatcher.Invoke(Action callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
   at System.Windows.Threading.Dispatcher.Invoke(Action callback)
   at PowerLauncher.ViewModel.MainViewModel.OnHotkey() in D:\AppDev\Github\PT_ValHelp\src\modules\launcher\PowerLauncher\ViewModel\MainViewModel.cs:line 973
   at PowerLauncher.ViewModel.MainViewModel.ProcessHotKeyMessages(IntPtr wparam, IntPtr lparam) in D:\AppDev\Github\PT_ValHelp\src\modules\launcher\PowerLauncher\ViewModel\MainViewModel.cs:line 834
   at PowerLauncher.MainWindow.ProcessWindowMessages(IntPtr hwnd, Int32 msg, IntPtr wparam, IntPtr lparam, Boolean& handled) in D:\AppDev\Github\PT_ValHelp\src\modules\launcher\PowerLauncher\MainWindow.xaml.cs:line 163
   at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   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)

I think this was introduced by #33458 .

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

Other Software

Operating system: Windows 10, Version 22H2 (OS Build 19045.4529)

github-actions[bot] commented 3 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

htcfreek commented 3 months ago

CC: @jaimecbernardo, @crutkas, @ethanfangg

jaimecbernardo commented 3 months ago

We had just noticed it too. Thanks for opening the issue. Fix is here: https://github.com/microsoft/PowerToys/pull/33505

Although you said it happens on Windows 11? @htcfreek , we've only had it happen for us on Windows 10. Can you please verify Windows 11 again?

jaimecbernardo commented 3 months ago

Actual logs from Windows 11 failing would be better here, since that one is not known to us.

htcfreek commented 3 months ago

Actual logs from Windows 11 failing would be better here, since that one is not known to us.

@jaimecbernardo You can ask @azlkiniue. He should have some logs from PR #33490 .

crutkas commented 3 months ago

I can repro this on a 21H2 VM on Azure. Seeing if it happens on 22h2

crutkas commented 3 months ago

Actually think i figured out why this may be crashing, the reset value is 0xFFFFFFFF but we do 0xFFFFFFFE

https://github.com/microsoft/PowerToys/pull/33505/files#diff-f7bf0647a296cbaf0bfaa5f4a75bd77e1c1b5ec25af2906ff5be6b88dcd823e5R1036

crutkas commented 3 months ago

Yup, got my local version running now.

image