ImageSharp icon indicating copy to clipboard operation
ImageSharp copied to clipboard

Enable Nullable ReferenceTypes

Open stefannikolei opened this issue 3 years ago • 4 comments

#2231

stefannikolei avatar Sep 18 '22 08:09 stefannikolei

@JimBobSquarePants I think you could have a first look. Let me know what you think and what parts should be changed.

stefannikolei avatar Sep 21 '22 15:09 stefannikolei

Hmm... there feels like there is way too much changed in this PR, this doesn't feel like the right way to tackle adding NRT into the codebase, it feeld like it should be a much more targeted, file by file/section by section changed, there is way to much expert knowledge required to apply some of these fixes globally, just deciding what should be nullable Vs having more sensible defaults to just changing {get; set;} to {get; init;} there is no one pattern that's right so each change needs review in detail..

I would propose we close this huge PR (sorry about that @stefannikolei ) and instead replace it with a first PR of enable the csproj setting but inline opt out all files with warnings. Then, as a series of follow up PRs, the various sections can be tackled.

This should mean any new files/code will have it enabled by default and we can be more methodical in applying the right fixes as we go.

PS. We should also aim to tackle the public API surface first before diving into the internals.

tocsoft avatar Sep 22 '22 12:09 tocsoft

It's with a heavy heart that I have to agree with @tocsoft here.

I started a review of the PR and while there is some low hanging fruit - Equals( object) - there are several places where we are going to have to significantly refactor the codebase in order to achieve safe nullability handling.

This is my fault. I should have investigated further before encouraging anyone to attempt a single PR.

I'm so, so sorry that you have made so much effort here with so little result.

JimBobSquarePants avatar Sep 22 '22 12:09 JimBobSquarePants

It's with a heavy heart that I have to agree with @tocsoft here.

I started a review of the PR and while there is some low hanging fruit - Equals( object) - there are several places where we are going to have to significantly refactor the codebase in order to achieve safe nullability handling.

This is my fault. I should have investigated further before encouraging anyone to attempt a single PR.

I'm so, so sorry that you have made so much effort here with so little result.

Its ok. NRT is not an easy change. And it gets big really fast. And errors are there to be done :)

I would change it back to draft. Perhaps it is useful for anyone to look up when making the changes in smaller steps

stefannikolei avatar Sep 22 '22 12:09 stefannikolei

Thanks for understanding @stefannikolei

JimBobSquarePants avatar Sep 25 '22 02:09 JimBobSquarePants

Sorry I have broken so much! It was really important to get #2276 merged in as it was blocking development.

JimBobSquarePants avatar Dec 14 '22 22:12 JimBobSquarePants

@JimBobSquarePants this is the old one. I will close it. To not confuse anyone.

I will merge your changes in my branch and fix the problems

stefannikolei avatar Dec 14 '22 22:12 stefannikolei