RenderOptions.EdgeModeProperty EdgeMode.Alias with StreamGeometry crashes with UCEERR_RENDERTHREADFAILURE under Windows 10
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
* .NET Core Version: 3.1.201 b1768b4ae7
* Windows version: Version 1903 (OS Build 18362.1082)
* Does the bug reproduce also in WPF for .NET Framework 4.8?: YES 4.7.2, Unknown at 4.8, development locked at 4.7.2,
* Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? NO
**Problem description:**
Drawing line-list using StreamGeometry causes rendering lockup and exception-on-resize when using RenderOptions.EdgeModeProperty set to EdgeMode.Alias. Exhibited under Windows 10 using NVidia and AMD hardware. Does not occur under Windows 7.
**Actual behavior:**
Draw a line list using StreamGeometry, and begin to resize the render area using a grid splitter. When AntiAliasing is enabled (the default) everything is fine. Turn off AntiAliasing using EdgeModeProperty and the UI will lock up. Resize the whole UI and UCEERR_RENDERTHREADFAILURE is thrown. There is something specific to the provided repro data set that causes this to happen, but it appears to be when multiple lines begin to stack on each other. Lines are added with context.LineTo(p1, true, false); where isStroked: true, isSmoothJoin=false. Note that it does not matter if I use context.LineTo or context.PolyLineTo.
```
var x = DataSet.Get();
StreamGeometry generatedGeometry = new StreamGeometry();
// Open the context to use for drawing.
using (StreamGeometryContext context = generatedGeometry.Open())
{
int numSamples = x.Count;
Point p0 = x[0];
// Start at the first point.
context.BeginFigure(p0, true, false);
for (int i = 1; i < numSamples; i++)
{
Point p1 = x[i];
// Add the points after the first one.
context.LineTo(p1, true, false);
}
context.Close();
}
generatedGeometry.Freeze();
drawingContext.DrawGeometry(null, thePen, generatedGeometry);
```
**Expected behavior:**
Application should not crash when drawing aliased lines (as in Windows 7)
**Minimal repro:**
The minimal repro requires drawing an 849-point line graph using StreamGeometry api, and setting RenderOptions.EdgeModeProperty to EdgeMode.Alias. Only some data causes the crash but when provided, the same data causes the crash consistently.
I have generated a very simply sample at https://github.com/sphet/Crash-WPF-Edge-Mode-Alias with a sample data set that causes the problem. Grabbing the vertical gripper and moving back and forth works fine, but when the checkbox is disabled to disable anti aliasing, movement of the vertical gripper causes application to lockup and crash.
Disabling hardware acceleration prevents this issue, but is not acceptable due to performance impacts. Checked on multiple machines with multiple graphics cards and drivers.
Are there known issues around this API? I cannot find any.
Contributor guide
Assessment
This issue has not been assessed yet.