Fix handling of parameters with default null #85
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This in an attempt of improving handling of nullable parameters.
In our solution at work, all projects have
<Nullable>disable</Nullable>
. In some of the generated interfaces, we receive the warningwarning CS8625: Cannot convert null literal to non-nullable reference type.
, because the interfaces are generated with#nullable enable
and have parameters likestring input = null
.I've changed the generator so that these parameters activate the nullable mode and add a
?
if it's missing.There were some changes in the tests I didn't expect, e.g. Misc.CustomNameSpace, but I think they're all correct like this.
Note that for 100% correctness, I think we would need to check the semantic model for every method and get the nullable context to decide if a parameter is actually nullable or not.