Skip to content

Enable Nullable ReferenceTypes #2236

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

Closed
wants to merge 68 commits into from
Closed

Enable Nullable ReferenceTypes #2236

wants to merge 68 commits into from

Conversation

stefannikolei
Copy link
Contributor

@stefannikolei stefannikolei commented Sep 18, 2022

@stefannikolei stefannikolei changed the title Enable Nullable ReferenceTypes #2231 Enable Nullable ReferenceTypes Sep 18, 2022
@@ -148,7 +148,7 @@ public static Memory<TPixel> DangerousGetPixelRowMemory<TPixel>(this ImageFrame<
Guard.MustBeGreaterThanOrEqualTo(rowIndex, 0, nameof(rowIndex));
Guard.MustBeLessThan(rowIndex, source.Height, nameof(rowIndex));

return source.PixelBuffer.GetSafeRowMemory(rowIndex);
return source.PixelBuffer!.GetSafeRowMemory(rowIndex);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JimBobSquarePants Should I look for all places where I used ! and add an ArgumentNullException.ThrowIfNull?

@stefannikolei stefannikolei marked this pull request as ready for review September 21, 2022 15:07
@stefannikolei
Copy link
Contributor Author

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

@tocsoft
Copy link
Member

tocsoft commented Sep 22, 2022

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.

@JimBobSquarePants
Copy link
Member

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.

@stefannikolei
Copy link
Contributor Author

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

@JimBobSquarePants
Copy link
Member

Thanks for understanding @stefannikolei

@JimBobSquarePants
Copy link
Member

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

@stefannikolei
Copy link
Contributor Author

@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 stefannikolei deleted the stefannikolei/enable_nullable branch January 1, 2023 10:33
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.

3 participants