dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.24k stars 1.76k forks source link

Entry.Style is Not Nullable #25227

Open david-maw opened 1 month ago

david-maw commented 1 month ago

Description

(new Entry()).Style = null; compiles without error in .Net 8 and earlier but in .NET 9 it produces a warning warning CS8625: Cannot convert null literal to non-nullable reference type.

Steps to Reproduce

  1. Create a new MAUI App
  2. Add (new Entry()).Style = null; somewhere (I did it in OnCounterClicked, but anywhere syntactically correct will do.
  3. On .NET 9 it will emit the warning on 8 it will compile.

I did this on .NET 9 RC2 but reported RC1 below because there's no pulldown value for RC2 yet.

Link to public reproduction project repository

No response

Version with bug

9.0.0-rc.1.24453.9

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.91 SR9.1

Affected platforms

Windows, I was not able test on other platforms

Affected platform versions

all

Did you find any workaround?

Do not treat warnings as errors and just ignore the warning.

Relevant log output

No response

ninachen03 commented 1 month ago

This issue has been verified using Visual Studio 17.12.0 Preview 3(9.0.0-rc.1.24453.9 ). Can repro this issue , works fine on 17.12.0 Preview 2.1(8.0.91)

Image

jsuarezruiz commented 2 weeks ago

@StephaneDelcroix Thoughts?