dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.43k stars 987 forks source link

Infinite loop in System.Drawing.Graphics between IsVisible(Point) and IsVisible(int, int) #12538

Open Brisingr-DE opened 1 day ago

Brisingr-DE commented 1 day ago

.NET version

.net9.0

Did it work in .NET Framework?

Yes

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

.net8.0

Issue description

https://github.com/dotnet/winforms/blob/e91e3bc158717736dc2c5d3ebfa8b6463ef88487/src/System.Drawing.Common/src/System/Drawing/Graphics.cs#L583-L585

Steps to reproduce

  1. Create a new WinForms-Project targetting .net9.0
  2. add the following lines in the contructor of Form1
        var graphis = CreateGraphics();
        graphis.IsVisible(Point.Empty);
  3. Run the application
elachlan commented 1 day ago

@Olina-Zhang can your team please test this?

Olina-Zhang commented 22 hours ago

@Olina-Zhang can your team please test this?

It is a regression issue, regressed from .NET 9.0. Works well in .NET 8.0

.NET 8.0 result: Image

.NET 9.0/.NET 10.0 latest build result: Image System.StackOverflowException HResult=0x800703E9 Message=Exception of type 'System.StackOverflowException' was thrown.

elachlan commented 21 hours ago

@Olina-Zhang did your team want to fix it?

I figure you change one of the signatures to call the float or PointF overloads.

kirsan31 commented 17 hours ago

I figure you change one of the signatures to call the float or PointF overloads.

I think IsVisible((float)x, y) will be a bit better 😌