dotnet / dotnet/winforms

Unstable unit test: System.Windows.Forms.Tests.RadioButtonRendererTests.RadioButtonRenderer_DrawRadioButton_OverloadWithHandle

Open
#12,935 0 comments 0 reactions 0 assignees View on GitHub
disabled-test test-bug
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

### Test

System.Windows.Forms.Tests.RadioButtonRendererTests.RadioButtonRenderer_DrawRadioButton_OverloadWithHandle(focus: True)

### Issue description

**Error Message:**

- **In X86:**
System.InvalidOperationException : Invalid handle (0)

- **Stack trace:**

```
at Windows.Win32.Graphics.Gdi.DeviceContextHdcScope.ValidateHDC() in /_/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/Gdi/DeviceContextHdcScope.cs:line 186
at Windows.Win32.Graphics.Gdi.DeviceContextHdcScope..ctor(IHdcContext deviceContext, ApplyGraphicsProperties applyGraphicsState, Boolean saveHdcState) in /_/src/System.Private.Windows.GdiPlus/Windows/Win32/Graphics/Gdi/DeviceContextHdcScope.cs:line 147
at System.Windows.Forms.DeviceContextExtensions.ToHdcScope(IDeviceContext deviceContext, ApplyGraphicsProperties applyProperties) in /_/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/DeviceContextExtensions.cs:line 184
at System.Windows.Forms.TextRenderer.DrawTextInternal(IDeviceContext dc, ReadOnlySpan`1 text, Font font, Rectangle bounds, Color foreColor, Color backColor, TextFormatFlags flags) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Rendering/TextRenderer.cs:line 307
at System.Windows.Forms.TextRenderer.DrawText(IDeviceContext dc, String text, Font font, Rectangle bounds, Color foreColor, TextFormatFlags flags) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Rendering/TextRenderer.cs:line 205
at System.Windows.Forms.RadioButtonRenderer.DrawRadioButton(Graphics g, Point glyphLocation, Rectangle textBounds, String radioButtonText, Font font, TextFormatFlags flags, Boolean focused, RadioButtonState state, HWND hwnd) in /_/src/System.Windows.Forms/src/System/Windows/Forms/Controls/Buttons/RadioButtonRenderer.cs:line 147
at System.Windows.Forms.Tests.RadioButtonRendererTests.RadioButtonRenderer_DrawRadioButton_OverloadWithHandle(Boolean focus) in /_/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/RadioButtonRendererTests.cs:line 118
at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.