Skip to content

Conversation

paramamue
Copy link

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 warning warning CS8625: Cannot convert null literal to non-nullable reference type., because the interfaces are generated with #nullable enable and have parameters like string 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant