Skip to content

Fix freezing with gpu #3384

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

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from
Draft

Conversation

@prlabeler prlabeler bot added the bug Something isn't working label Mar 26, 2025

This comment has been minimized.

@@ -236,6 +236,7 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
DependencyPropertyDescriptor
.FromProperty(VisibilityProperty, typeof(StackPanel)) // History는 StackPanel이라고 가정
.AddValueChanged(History, (s, e) => UpdateClockPanelVisibility());
_viewModel.ClearAllCacheModes(this);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Emmmm, can I know all UIElement in all the window be clear cache? Thank you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the settings window (secondary window) also have its cachemode=null? For now, separate from this PR, I tried settingwindow the cache mode of all UI elements in both the main window and the settings window to Null in code, but it didn’t resolve the issue.

Copy link

@lindexi lindexi Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@onesounds What worries me is that elements are added dynamically, and they are added after loading. And as my test, removing all the CacheMode can fix dotnet/wpf#2158 issues. If you can sure all the CacheMode be removed, I think may be you meet the other issues, not the dotnet/wpf#2158

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@onesounds Can I ask any other try update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't go well. Since we're using ModernWpf, I thought that instead of creating and building a new NuGet package to remove all the resources used by ModernWpf, I should find and remove them in the code — and I tried that, but it didn't work. I can’t tell if I’m doing it right, so I discussed it with Copilot and confirmed through debug code that all the caches were cleared, but even then, I’m not sure if it really worked correctly.

I also tested a few suggestions from cyclonring, but they all failed. The only thing that almost worked was an idea I came up with — showing the first window again at the moment of a "system change" (which removed the freezing of the settings window). But during testing, a focus loss situation. When the first window is hidden in this case, it causes the first window itself to freeze instead. I ended up giving up on this task because I discovered that the first window itself freezes as a result. #3378

I’ve asked my team members for help with this a few times, but no one seems interested. It feels like programmers tend to dislike this kind of work — the kind that doesn’t have a clear logic or defined answer and requires a lot of trial and error over a long period. Everyone seems to think it would be better and easier to just abandon WPF and move to something else. From my experience, I know that it's not that easy — which is why I want to find a solution within WPF.

In any case, I think it would be better if someone more capable than me took over this task and asked you questions. (The person you're talking to — me — is more of a designer and doesn’t really know much about programming.)

@Flow-Launcher/team

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ClearAllCacheModes cannot bring any difference.

@Jack251970 I not sure this issus is same as dotnet/wpf#2158 . Maybe other case cause the freeze render issues.

Copy link
Contributor Author

@onesounds onesounds Apr 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jack251970 This issue basically comes down to the fact that the freeze gets lifted when the primary window is shown. So the behavior you're describing is actually expected. What’s happening is that when the primary window is hidden, something keeps trying to render to it, and that’s causing the second window (in our case, the settings window) to crash.

Sorry for my confusion. I mean the second window starts to work when I brought main window with hotkey.

Open FL -> Sleep -> Unlock -> Open settings window (Freeze) -> Open main window with hotkey (Settings window starts to render)

You're basically saying the same thing I described. After the lock screen, the settings window freezes, and then when the first window is shown, the settings window becomes active again. That's the basic structure of the changes I made in my initial PR. So you had told me, "There's an issue where the window is being shown," right? So I said something like, "This PR resolves the issue when the window is shown, so the fix is based on that behavior — therefore, it's not fair to consider the fact that the window is being shown as a problem."

Copy link
Contributor

@Jack251970 Jack251970 Apr 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ClearAllCacheModes cannot bring any difference.

@Jack251970 I not sure this issus is same as dotnet/wpf#2158 . Maybe other case cause the freeze render issues.

Calling ClearAllCaches cannot find any UI elements with image caches. I am also not sure if this issue related to dotnet/wpf#2158.

Copy link

@lindexi lindexi Apr 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jack251970 and @onesounds Can you make sure that no new elements with BitmapCache are added after OnLoaded? Thank you.

As #3384 (comment) , what worries me is that elements are added dynamically, and they are added after loading.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jack251970 and @onesounds Can you make sure that no new elements with BitmapCache are added after OnLoaded? Thank you.

As #3384 (comment) , what worries me is that elements are added dynamically, and they are added after loading.

For second window, I do think there are any elements added dynamically. For main window, I think there could be some dynamically added elements if we change query text. But even if we do not change query text, the freezing issue still exists.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link

github-actions bot commented Apr 7, 2025

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors Count
❌ forbidden-pattern 24
⚠️ non-alpha-in-dictionary 19

See ❌ Event descriptions for more information.

Forbidden patterns 🙅 (1)

In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.

These forbidden patterns matched content:

s.b. workaround(s)

\bwork[- ]arounds?\b
If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 min review bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants