dotnet / winforms

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

Cursor icon does not display correctly on form designer with .NET 9.0 targeted #10185

Closed Philip-Wang01 closed 9 months ago

Philip-Wang01 commented 1 year ago

.NET version

9.0.100-alpha.1.23524.13

Did it work in .NET Framework?

Yes

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

Yes, this is a regression issue that will not be reproduced in .NET 6.0/7.0/8.0.

Issue description

Cursor icon does not display correctly on form designer with .NET 9.0 targeted image The cursor icon changes are not particularly stable. test90cursor

Steps to reproduce

  1. Create a WinForms .NET 8.0 project (VS does not currently support the creation of 9.0 projects).
  2. Change the TargetFramework from net8.0-windows to net9.0-windows in the csproj file.
  3. Clean and build the solution, reload form designer.
  4. Add some controls to the form designer and observe the cursor icon.
lonitra commented 1 year ago

The cause of this issue is due to the removal of code in CursorConverter.ConvertTo method in https://github.com/dotnet/winforms/pull/10005. For some reason, we are unable to get the property name for one of our own cursors..

elachlan commented 10 months ago

@Philip-Wang01 does this issue still reproduce?

Philip-Wang01 commented 10 months ago

@elachlan This issue still repro on the latest .NET 9.0: 9.0.100-alpha.1.24059.8.

elachlan commented 10 months ago

@lonitra I changed the existing test for convert to string and tested each Cursor value. It passed.

I also haven't noticed anything strange in the demo console. Should it reproduce there or only in the vs designer?

lonitra commented 10 months ago

@lonitra I changed the existing test for convert to string and tested each Cursor value. It passed.

I also haven't noticed anything strange in the demo console. Should it reproduce there or only in the vs designer?

Interesting 🤔 I hadn't tried to repro it on demo console before. I had only been able to repro it in vs designer by using dlls built from main. I have not had a chance to spend more time with this, but my original suspicion was something needed to be updated on designer side.

MelonWang1 commented 9 months ago

Verified this issue on .NET 9.0.0-preview.2.24107.18 with dlls built from winforms repo of main branch, the issue has been fixed that the cursor icon displays correctly on form designer with .NET 9.0 targeted.

https://github.com/dotnet/winforms/assets/94418985/f7394e5a-22e0-466d-b3ae-2c8cfb6876df

Syareel-Sukeri commented 8 months ago

Verified this issue with .NET SDK 9.0 Preview 2 test pass build, this issue was fixed. Cursor icon display correctly on form designer when .NET 9.0 targeted. Test result is the same as above.