Skip to content

LinkLabel System.ArgumentException and application crash #13973

@SylkoZ75

Description

@SylkoZ75

.NET version

Hi,

We found an issue with the latest version of the .NET SDK (10.0.100-rc.2.25502.107-win-x64) in the LinkLabel. If the LinkArea is modified in the program code, a System.ArgumentException is thrown and the application crashes.

This is the call stack:

HResult=0x80070057
Message=Parameter is not valid.
Source=System.Private.Windows.Core
StackTrace:
at Windows.Win32.Graphics.GdiPlus.StatusExtensions.ThrowIfFailed(Status status)
at Windows.Win32.Graphics.GdiPlus.GpRegionExtensions.InitializeFromGdiPlus(GpRegion* region, GpGraphics* graphics)
at Windows.Win32.Graphics.GdiPlus.GpRegionExtensions.GetRegionScope(IPointer1 region, IPointer1 graphics)
at System.Windows.Forms.Control.Invalidate(Region region, Boolean invalidateChildren)
at System.Windows.Forms.LinkLabel.set_FocusLink(Link value)
at System.Windows.Forms.LinkLabel.UpdateSelectability()
at System.Windows.Forms.LinkLabel.LinkCollection.Add(Link value)
at System.Windows.Forms.LinkLabel.set_LinkArea(LinkArea value)

Did it work in .NET Framework?

Yes

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

Yes, it worked perfect in .Net 8. It also works, if you set UseCompatibleTextRendering = true;

Issue description

The application will crash after LinkLabel.LinkArea is set at runtime.

Environment
Windows 11 Pro Version 25H2 Build 26200.6899
.Net dotnet-sdk-10.0.100-rc.2.25502.107-win-x64
VS2026 Version: Insiders [11111.16]

Steps to reproduce

  • Create a new WinForms application for .Net 10 (RC2) in VS2026 Version: Insiders [11111.16]
  • Add a LinkLabel to the main form
  • Configure the LinkArea in the LinkClicked event
  • Run the application and click the LinkLabel

I attached this as sample application

WinFormsApp1.zip

Metadata

Metadata

Assignees

Labels

💥 regression-releaseRegression from a public releaseservicing-consider.NET Shiproom label indicating a PR seeks to enter into a branch under Tell-Mode criteria

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions