Skip to content
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

Conditional compilation for Nullable ref types #2146

Merged
merged 12 commits into from
Jan 17, 2023
Merged

Conversation

andrueastman
Copy link
Member

@andrueastman andrueastman commented Jan 11, 2023

Closes #2073

Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for starting the work here, great work so far. A couple of remarks to help you through the process:
Would additional data properties need any annotation?
Same thing for complex types properties (single value of other types being generated)?
Did you start the work on the kiota dependencies? I'm not sure what the impact would be on interfaces since their prototype would change?
I think the methods return types (when tasks of something) are still missing.

@andrueastman
Copy link
Member Author

andrueastman commented Jan 12, 2023

Thanks for checking this out @baywet,

Would additional data properties need any annotation?

I believe we are okay with these as they are initialized in the constructor with default non-null values meaning they won't be null.

Same thing for complex types properties (single value of other types being generated)?

I believe this is catered for example https://github.com/microsoft/kiota-samples/blob/4855fb63973b0ae20b602245bab902517694a686/msgraph-mail/dotnet/Models/Message.cs#L22

Did you start the work on the kiota dependencies? I'm not sure what the impact would be on interfaces since their prototype would change? I think the methods return types (when tasks of something) are still missing.

This is still WIP(Added as TODOs in the description to make clearer). I was first trying to get to understand what types would really need the annotations in the generated code as we already generate a bit of error handling code and initializers that assure some types won't be null and therefore would not need annotations.

@andrueastman andrueastman changed the title [WIP] Conditional compilation for Nullable ref types Conditional compilation for Nullable ref types Jan 13, 2023
@andrueastman andrueastman requested a review from baywet January 13, 2023 08:07
@andrueastman andrueastman self-assigned this Jan 13, 2023
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

98.2% 98.2% Coverage
0.0% 0.0% Duplication

@andrueastman andrueastman merged commit 8010789 into main Jan 17, 2023
@andrueastman andrueastman deleted the andrueastman/NRT branch January 17, 2023 16:42
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.

C# nullable reference types and sample compilation error
2 participants