Emit nullable ref annotated code
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.5k
- Forks
- 124
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 9
Description
When the project langversion is >= 8, could you also put
#nullable enableor at least#nullable annotationsin the file or around the parameter declaration and useSafeHandle?as the parameter type so that IntelliSense shows me that nulls are anticipated?
Originally posted by @jnm2 in https://github.com/microsoft/CsWin32/issues/129#issuecomment-781466704
If we annotate at all, we need to be consistent so users can trust that a parameter is required when we don't annotate it. The metadata has many [Optional] annotations on its inputs to help with this, but I don't know how consistently it is applied.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review issue #129 and the generator logic that consumes Win32 metadata, especially its [Optional] inputs, to determine the nullable-annotation policy for langversion >= 8. Done means generated signatures consistently communicate anticipated nulls, including SafeHandle? where the metadata supports it, without making required parameters appear optional.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100