Skip to content

Add missing nullability annotation in CodeDom - #72532

Merged
stephentoub merged 1 commit into
dotnet:mainfrom
DustinCampbell:fix-typeref-nullability
Jul 22, 2022
Merged

Add missing nullability annotation in CodeDom#72532
stephentoub merged 1 commit into
dotnet:mainfrom
DustinCampbell:fix-typeref-nullability

Conversation

@DustinCampbell

Copy link
Copy Markdown
Member

The CodeTypeReference constructors allow a null type name to be provided, but one constructor was missed during annotation.

The `CodeTypeReference` constructors allow a `null` type name to be
provided, but one constructor was missed during annotation.
@ghost ghost added the area-System.CodeDom label Jul 20, 2022
@ghost ghost assigned DustinCampbell Jul 20, 2022
@ghost

ghost commented Jul 20, 2022

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/area-system-codedom
See info in area-owners.md if you want to be subscribed.

Issue Details

The CodeTypeReference constructors allow a null type name to be provided, but one constructor was missed during annotation.

Author: DustinCampbell
Assignees: -
Labels:

area-System.CodeDom

Milestone: -

@stephentoub

stephentoub commented Jul 20, 2022

Copy link
Copy Markdown
Member

CodeDom hasn't been annotated yet. The annotations that are there are purely for where these files were included in other projects that are annotated and where these types are included as internal. You can see at:

<Nullable>annotations</Nullable>

that it's one of our few remaining projects that's still <Nullable>annotations</Nullable>.

@stephentoub

Copy link
Copy Markdown
Member

(If you'd like to actually annotate it and enable nullable reference types in the project, that would be more than welcome 😄)

@DustinCampbell

Copy link
Copy Markdown
Member Author

CodeDom hasn't been annotated yet.

That's a head-scratcher. I filed this when I updated a package ref to System.CodeDom to 6.0.0 in another repo and hit a nullability warning with this particular constructor.

@DustinCampbell

DustinCampbell commented Jul 20, 2022

Copy link
Copy Markdown
Member Author

It appears that CodeTypeReference.cs specifically has #nullable enable at the top of the file. I don't think the project setting overrides that.

@stephentoub

Copy link
Copy Markdown
Member

It appears that CodeTypeReference.cs specifically has #nullable enable at the top of the file.

Ugh! We should do a sweep and remove all #nullable enable and replace them with annotations on any projects that still need this... at this point I expect most of the usages are stale.

@DustinCampbell

DustinCampbell commented Jul 20, 2022

Copy link
Copy Markdown
Member Author

We should do a sweep and remove all #nullable enable and replace them with annotations on any projects that still need this

Searching src\Libraries shows 87 instances of #nullable enable in 74 files. The two that are pulled into System.CodeDom are CodeObject.cs and CodeTypeReference.cs. (I guess because they're in Common\src\System\CodeDom?)

Would you prefer that I remove the #nullable enable in the Common\src\System\CodeDom files until System.CodeDom is annotated? Alternatively, I could wrap them in #if !CODEDOM.

@stephentoub

Copy link
Copy Markdown
Member

Would you prefer that I remove the #nullable enable in the Common\src\System\CodeDom files until System.CodeDom is annotated?

I'm right in the middle of something, but I'll look at all of these today.

@stephentoub

Copy link
Copy Markdown
Member

#72568

@stephentoub stephentoub reopened this Jul 22, 2022
@stephentoub

Copy link
Copy Markdown
Member

Thanks.

@stephentoub
stephentoub merged commit 885207f into dotnet:main Jul 22, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Aug 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants