Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use nullable reference types (C# 8.0) #19514

Open
Shkarlatov opened this issue Jul 13, 2021 · 7 comments
Open

Use nullable reference types (C# 8.0) #19514

Shkarlatov opened this issue Jul 13, 2021 · 7 comments

Comments

@Shkarlatov
Copy link
Contributor

REQUEST MOTIVATION

I suggest switching to the 8.0 language version and enabling "Nullable reference types". You need to start with basic things like the openra.game project.

The change will reduce the number of NRE errors, will remove the "! = Null" checks and possibly improve performance.

PROPOSED SOLUTION

Allow lang ver 8.0 in OpenRA.Game/OpenRA.Game.csproj

    <LangVersion>8.0</LangVersion>
    <!-- In future change this to "enable"-->
    <Nullable>warnings</Nullable>
    <!-- Then project will be annotated, change this to "true"-->
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>

EXPECTED SIDE EFFECTS

Nothings

ALTERNATIVES

Use JetBrains.Annotations nuget package

@teinarss
Copy link
Contributor

teinarss commented Jul 13, 2021 via email

@Shkarlatov
Copy link
Contributor Author

Why support mono? NET5 supports major platforms (Win, lin, osx). Support for mobile platforms will be added in the future. It is also possible to build NET 5.0 for FreeBSD freebsd-requirements.md, NET5.0 on FreeBSD.

It makes sense to support mono if there was a port to mobile platforms.

@teinarss
Copy link
Contributor

teinarss commented Jul 13, 2021 via email

@Shkarlatov
Copy link
Contributor Author

@PunkPun
Copy link
Member

PunkPun commented Jun 20, 2023

#20765

@alex1ozr
Copy link

We still have players that are using an older version of macosx that doesn't support never versions of core. Not sure when we can drop mono completely.

On Tue, 13 Jul 2021, 15:00 Alexander Shkarlatov, @.***> wrote: Why support mono? NET5 supports major platforms (Win, lin, osx). Support for mobile platforms will be added in the future. It is also possible to build NET 5.0 for FreeBSD freebsd-requirements.md https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/freebsd-requirements.md, NET5.0 on FreeBSD https://github.com/jasonpugsley/installer. It makes sense to support mono if there was a port to mobile platforms. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#19514 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AESI7GGTECETKA725M5WUJLTXQ2HJANCNFSM5AJAFU4A .

.NET 6 is supported since macOS 10.15 "Catalina" (2019). It is pretty old OS version and it supports a lot of outdated macs anyway. There is no reason to stay with almost dead Mono.
https://learn.microsoft.com/en-us/dotnet/core/install/macos

@PunkPun
Copy link
Member

PunkPun commented Oct 20, 2023

It's strange that it wasn't linked, but there was a small push for enabling nullable context #20796

My takeaway from it was that it forces some type gymnastics and boiler plate functions. I'm not really sure if thats desired, there are many cases in which you know that a value can't be null yet the compiler doesn't. Personally I'm just not interested in working on the migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants