Skip to content

Enable nullability in StronglyTypedResourceBuilder - #9663

Merged
dreddy-work merged 2 commits into
dotnet:mainfrom
halgab:StronglyTypedResourceBuilder-null
Sep 25, 2023
Merged

Enable nullability in StronglyTypedResourceBuilder#9663
dreddy-work merged 2 commits into
dotnet:mainfrom
halgab:StronglyTypedResourceBuilder-null

Conversation

@halgab

@halgabhalgab commented Aug 4, 2023

Copy link
Copy Markdown
Contributor

I had to fix nullable annotations of ResXDataNode in the process. This class was annotated for .Net 8, so it's not too late to make the changes without too much hassle.
I also unearthed quite a few problems in the annotations of System.CodeDom that forced me to use the null forgiving operator more than I should normally have to.

Proposed changes

  • Enable nullability in StronglyTypedResourceBuilder
Microsoft Reviewers: Open in CodeFlow

@halgab
halgab requested a review from a team as a code ownerAugust 4, 2023 13:15
@ghostghost assigned halgabAug 4, 2023
@ghostghost added the area-NRT label Aug 4, 2023
string valueAsString = node.GetValue((AssemblyName[])null).ToString();
string typeName = node.GetValueTypeName((AssemblyName[]?)null)!;
Type? type = Type.GetType(typeName);
string? valueAsString = node.GetValue((AssemblyName[]?)null)!.ToString();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this declared as nullable? you already use ! before converting it to oString()

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

ToString outputs a string?

@dreddy-workdreddy-work added the waiting-author-feedback The team requires more information from the author label Aug 4, 2023
@ghostghost removed the waiting-author-feedback The team requires more information from the author label Aug 4, 2023
@elachlan

Copy link
Copy Markdown
Contributor

@halgab do you plan to tackle the problems in runtime?

@halgab

Copy link
Copy Markdown
ContributorAuthor

The dotnet team started to discuss the issue again in dotnet/runtime#78036. I'm waiting to see where this discussion is going before offering my help to annotate System.CodeDom.

@halgab
halgabforce-pushed the StronglyTypedResourceBuilder-null branch from 970ae36 to f5c2266CompareAugust 7, 2023 20:24
@halgab
halgabforce-pushed the StronglyTypedResourceBuilder-null branch 2 times, most recently from 72cd2f9 to 0caeec3CompareAugust 15, 2023 12:13
@halgab

Copy link
Copy Markdown
ContributorAuthor

Now that dotnet/runtime#90401 has been merged, I rebased and removed several occurences of !

@halgab
halgabforce-pushed the StronglyTypedResourceBuilder-null branch from 0caeec3 to b3d33caCompareSeptember 20, 2023 09:23
@dreddy-workdreddy-work added the ready-to-merge PRs that are ready to merge but worth notifying the internal team. label Sep 22, 2023
@dreddy-work

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@dreddy-work
dreddy-work merged commit 2891898 into dotnet:mainSep 25, 2023
@ghostghost removed the ready-to-merge PRs that are ready to merge but worth notifying the internal team. label Sep 25, 2023
@halgab
halgab deleted the StronglyTypedResourceBuilder-null branch September 26, 2023 05:14
@ghostghost locked as resolved and limited conversation to collaborators Oct 26, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@halgab@elachlan@dreddy-work