-
Notifications
You must be signed in to change notification settings - Fork 474
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
Helper tool for nullable annotations #4361
Comments
Tagging subscribers to this area: @safern, @ViktorHofer |
@mavasani @Evangelink @Youssef1313 Guys, sorry for direct ping but maybe some of you will be interested in this? |
So the idea is to provide a tool that would list all types (enum, class, interface, record, struct) with their namespace and their containing file. Could you confirm I got things right? |
@Evangelink What I understood is the tool would need to group classes into levels from the easiest to annotate, to the harder ones. The level of easiness or hardness will depend on the dependency tree between classes. |
I'm not sure this is the best way to implement this tool. It tends to lead to frequent cases where annotations are initially incorrect, but then later need to be corrected based on new information. The approach would be less likely to experience this if it went in the other direction:
But there are also exceptions to this, where you might want to annotate things in other orders:
My main concern here is a high likelihood that a tool could be implemented, only to find that at the end of the day it's still exactly the same difficulty as it was without the tool. |
Oh, I didn't expect you to show interest in my request :-), although I suppose many developers would be happy to find such a tool in .Net SDK.
Sorry for the bad description! I meant that on top there should be declared types without dependencies on other types declared in the project. The next group contains declared types, which depend only on the types from the previous group. You seem to be talking about the same.
Yes, the purpose of this tool is not to create a strategy but to assist in planning. With a report from the tool, developers can choose a path that is best for them.
No, no :-) PowerShell Engine (System,Managemet,Automation,csproj) has 734 files and 2422 declared types. This is exactly what I did. The tool is in https://github.com/iSazonov/TypeDependencyHelper
Enums has not references and should be excluded from the report. I added a reference to an issue with attached Excel example. |
This is much smaller than dotnet/roslyn. My experience there suggests the order of annotations doesn't really matter. You could map out the types based on dependencies, or you could just work in a random order. Both approaches seem to take the same amount of time and yield the same final result. |
Why then did .Net team create this dotnet/runtime#2339 In any case, as PowerShell maintainer, I would rather offer contributors a plan than say - grab any piece of code and annotate it. |
Probably the runtime team did the annotation based on what types/assemblies they think are used a lot by developers. (Note that the runtime provide public APIs that're used by other developers, so annotating makes a different to consumers, so priority based on API popularity sounds very reasonable. This might not be the same for PowerShell if it doesn't provide public APIs to be used by other developers). |
From dotnet/runtime#2339
Perhaps there are developers who come to annotate only their public interfaces and do not benefit from annotating their entire project, but this looks like consumer deception. Such a strategy is not even mentioned in the documentation |
@sharwell Can you please drive this issue forward? |
Ping @sharwell |
We are looking at dotnet/roslyn#52893 as the next action item related to nullable reference types. |
Do you think there is a need to keep this ticket open or shall it be somehow merged into the other one? Or maybe moved to roslyn side? |
In PowerShell repository we started the nullable annotation process but stopped because of huge complicity - hundreds of cross-referenced classes.
To continue this process, we need to create and arrange the list of classes into groups so that at the beginning there are the simplest classes, in the next group the classes that use them, etc.
To get such a report, we need a tool based on the Roslyn Analyzer API.
Since this tool would be useful to a large number of projects, not just PowerShell, I post this request here. The tool could be in SDK or be a standalone tool.
The text was updated successfully, but these errors were encountered: