microsoft / microsoft/microsoft-ui-xaml
Framerate drop in CompositionTarget.Rendering
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
The CompositionTarget.Rendering has inconsistent framework drops up to 10 FPS every few seconds which is very annoying and causes UI stutters. If this happens on a high-end machine, I can't imagine low-end machines.
### Steps to reproduce the bug
1. Open a new WinUI3 project
2. Run this code with debugger and check output:
using Microsoft.UI.Xaml;
using System.Diagnostics;
namespace TestFramerates
{
public sealed partial class MainWindow : Window
{
private long _last = 0;
public MainWindow()
{
InitializeComponent();
Microsoft.UI.Xaml.Media.CompositionTarget.Rendering += (_, _) =>
{
long now = Stopwatch.GetTimestamp();
if (_last != 0)
{
float ms = (float)(now - _last) / Stopwatch.Frequency * 1000f;
if (ms > 50f)
Debug.WriteLine($"[Frame] Gap: {ms:F1}ms at {System.DateTime.Now:HH:mm:ss.fff}");
}
_last = now;
};
}
}
}
Likely result:
[Frame] Gap: 95.3ms at 14:49:30.834
[Frame] Gap: 67.9ms at 14:49:35.728
[Frame] Gap: 55.7ms at 14:49:41.190
[Frame] Gap: 82.6ms at 14:49:45.385
### Expected behavior
The framerate should be consistent.
### Screenshots
_No response_
### NuGet package version
1.8.260317003
### Packaging type
Packaged (MSIX)
### Windows version
Windows 11 version 24H2 LTSC (26100, June Update)
### IDE
Other
### Additional context
Using Visual Studio 2026, caused me to debug the correctly working code for 3 days and finding out that the framework was buggy.
Contributor guide
Research direction
Start with the supplied WinUI 3 reproduction and the CompositionTarget.Rendering entry point, then compare its reported frame gaps with the expected rendering cadence on the stated Windows 11 environment. Done means identifying and correcting the framework-level cause of the periodic drops, with the reproduction no longer reporting gaps of 50ms or more.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100