Skip to content

Add nullable support where possible#692

Closed
jl0pd wants to merge 1 commit intoScottPlot:masterfrom
jl0pd:nullable
Closed

Add nullable support where possible#692
jl0pd wants to merge 1 commit intoScottPlot:masterfrom
jl0pd:nullable

Conversation

@jl0pd
Copy link

@jl0pd jl0pd commented Jan 11, 2021

New Contributors:
please review CONTRIBUTING.md

Purpose:
Add nullable reference types support
Resolves #691

New Functionality:
None

@jl0pd
Copy link
Author

jl0pd commented Jan 12, 2021

This is draft of what need to be done in order to support nullable reference types.
This commit actually should be split into several smaller commit:

  1. Annotate folder after folder, starting with signatures
  2. Annotate top-level files
  3. Annotate demo-applications (right now only core library is annotated)

Amount of warnings should be reduced to 0. Right now ~200 of them.

Some classes should be reworked, so they wouldn't get into invalid state, for example Image. It should have Bitmap set, but it's not enforced by constructor

Also there's couple of fixes that should be in different PRs

swharden added a commit that referenced this pull request Jan 23, 2021
Thanks @jl0pd #692

This is a breaking change, but will be released with 4.1-beta which has other breaking changes so this is an excellent time to fix it.
swharden added a commit that referenced this pull request Jan 23, 2021
It's an abstract class, so a public constructor does not make sense. Thanks @jl0pd for noting this #692
@swharden
Copy link
Member

This PR is a great example of how to nullables (and some switch expressions) in the core ScottPlot code base. Thanks @jl0pd! Unfortunately there remains ambiguity as to whether or not .NET Standard libraries (which use C# 7.3 by default) should be compiled using features of higher language versions, as discussed in #691. I'll close this PR for now, and we may open it up again depending on how that conversation progresses.

This PR is very insightful, and the steps described by #692 (comment) are excellent advice. Thanks @jl0pd for all the work you put into this! If/when the language version issue is resolved (or when we deprecate .NET Framework support) and the language version can be increased with confidence, this will be a great starting point to add nullable support throughout the library 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

C# 8 nullable support

2 participants