lepoco / lepoco/wpfui

Unhandled File not found 0x80070002 in DwmGetColorizationParameters

Open
#593 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
9.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

The DWM api is throwing a System.IO.FileNotFoundException when accessing Dwmapi.DwmGetColorizationParameters(out DWMCOLORIZATIONPARAMS dwParameters)

To Reproduce

Unknown

Expected behavior

The error is caught and a default color is applied

Screenshots

No response

OS version

Windows 10.0.22621

.NET version

.NET 6.0.16

WPF-UI NuGet version

https://github.com/lepoco/wpfui/commit/91a708991a69f168943e8d961cc123bf8ca92965

Additional context
System.IO.FileNotFoundException: 系统找不到指定的文件。 (0x80070002)
  ?, in void Dwmapi.DwmGetColorizationParameters(out DWMCOLORIZATIONPARAMS dwParameters)
  ?, in Color UnsafeNativeMethods.GetDwmColor()
  ?, in void Theme.Apply(ThemeType themeType, WindowBackdropType backgroundEffect, bool updateAccent, bool forceBackground)
  ?, in void Watcher.UpdateThemes(SystemThemeType systemTheme)
  ?, in void Watcher.Watch(Window window, WindowBackdropType backgroundEffect, bool updateAccents, bool forceBackground)+(object sender, RoutedEventArgs args) => { }
  ?, in void RoutedEventHandlerInfo.InvokeHandler(object target, RoutedEventArgs routedEventArgs)
  ?, in void EventRoute.InvokeHandlersImpl(object source, RoutedEventArgs args, bool reRaised)
  ?, in void UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
  ?, in void UIElement.RaiseEvent(RoutedEventArgs e)
  ?, in void BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
  ?, in object BroadcastEventHelper.BroadcastLoadedEvent(object root)
  ?, in void MediaContext.FireLoadedPendingCallbacks()
  ?, in void MediaContext.FireInvokeOnRenderCallbacks()
  ?, in void MediaContext.RenderMessageHandlerCore(object resizedCompositionTarget)
  ?, in object MediaContext.RenderMessageHandler(object resizedCompositionTarget)
  ?, in void MediaContext.Resize(ICompositionTarget resizedCompositionTarget)
  ?, in void HwndTarget.OnResize()
  ?, in IntPtr HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
  ?, in IntPtr HwndSource.HwndTargetFilterMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
  ?, in IntPtr HwndWrapper.WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
  ?, in object HwndSubclass.DispatcherCallbackOperation(object o)
  ?, in object ExceptionWrapper.InternalRealCall(Delegate callback, object args, int numArgs)
  ?, in object ExceptionWrapper.TryCatchWhen(object source, Delegate callback, object args, int numArgs, Delegate catchHandler)

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 at UnsafeNativeMethods.GetDwmColor in the stack trace and follow its call into Theme.Apply and Watcher.UpdateThemes. Reproduce the DwmGetColorizationParameters failure on the reported Windows and .NET versions, then verify that the exception is handled and a default color is applied without disrupting theme updates.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.