-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
C# 8.0 introduces great feature - nullable reference types.
https://devblogs.microsoft.com/dotnet/try-out-nullable-reference-types/
Many developers already benefit from the feature in their projects and expect that PowerShell API will be nullable annotated too.
This is a lot of work. @iSazonov and @powercode agreed to start the project. But we need more contributors and code reviewers.
@vexx32 @SeeminglyScience @KirkMunro welcome and please ask your friends and followers.
To make this work efficiently, we need Rules and Plan.
Rules
Best start is .Net team experience https://github.com/dotnet/runtime/blob/master/docs/coding-guidelines/api-guidelines/nullability.md
Main rule is that annotation PRs should not change code due to the high risk of making a bug.
I believe we should strongly follow the rule too and make separate PRs if we see a need to refactor a code and especially if we see a bug.
We could save more time if we fixed most code style issues before starting the project.
I started the work in #11916 but again I need a help with code review. (#11916 fix ~5000 issues from ~10000, and I hope to fix rest in follow some PRs. You could pull such PRs too).
Please use one pattern:
- one PR per type with name
Enable nullable: <namespace>.<type name> - enable directive before first type line (after XML comments) and restore directive after last type line without extra empty lines:
[Guid("AF86E2E0-B12D-4c6a-9C5A-D7AA65101E90")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
#nullable enable
internal interface IInspectable { }
#nullable restore- add XML comments to non-nullable members like "This never returns null." - good documentation helps a lot
Plan
In the file System.Management.Automation-20201109114545.xlsx
( Previous System.Management.Automation-20201109114545.xlsx
all SMA PowerShell types are sorted by dependency count.
We should annotate types by groups starting from group with dependency 0 (Group0), then 1 and so on.
Main rule here is - current annotating type should have all dependencies already annotated and merged.
Status
Working on Group0
Done - most of interface types was annotated.
In process - now we can annotate structs with dependency 0