Skip to content

DemoConsole app: An exception pops up when focusing on "Type Here" in contextMenuStrip under DarkMode #13624

Open
@Olina-Zhang

Description

@Olina-Zhang

.NET version

The latest main branch of Winforms repo

Did it work in .NET Framework?

Not tested/verified

Did it work in any of the earlier releases of .NET Core or .NET 5+?

Yes. It was regressed from the PR: #13360

Issue description

In DemoConsole test app of WinForms repo, an exception pops up when focusing on "Type Here" in contextMenuStrip under DarkMode

Image

Exception log:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=System.Windows.Forms
StackTrace:
at System.Windows.Forms.ToolStripSystemDarkModeRenderer.OnRenderArrow(ToolStripArrowRenderEventArgs e) in C:\Users\xxx\source\repos\winforms\src\System.Windows.Forms\System\Windows\Forms\Controls\ToolStrips\ToolStripSystemDarkModeRenderer.cs:line 566

Exception.mp4

Steps to reproduce

  1. Find the sample app: DemoConsole in Winforms repo
  2. Change it to .NET targeting only from Multi-targets
  3. Enable Dark mode by adding below code lines in the Program.cs file under DemoConsole project
#pragma warning disable WFO5001
        Application.SetColorMode(SystemColorMode.Dark);
#pragma warning restore WFO5001
  1. Run DemoConsole app
  2. Find ContextMenuStrip control in 'Use SnapLines' tabPage, then move mouse to 'Type Here' area

Metadata

Metadata

Labels

💥 regression-previewRegression from a preview releasearea-DarkModeIssues relating to Dark Mode featureuntriagedThe team needs to look at this issue in the next triage

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions