Added nullability attributes to the API#1983
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds nullable reference type annotations to MailKit's public API to address issue #1972. The changes enable C# 8.0+ nullable reference types across the codebase, providing compile-time null safety.
Changes:
- Enabled nullable reference types in MailKit.csproj by setting
<Nullable>enable</Nullable>and upgrading to LangVersion 12 - Added nullable annotations (
?) to reference type parameters, properties, and return types throughout the API - Updated unit tests to use proper constructors instead of object initializers for BodyPart types
- Removed obsolete parameterless constructors for event args classes
- Added proper null checks and null-forgiving operators where needed
Reviewed changes
Copilot reviewed 126 out of 126 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| MailKit/MailKit.csproj | Enabled nullable reference types and upgraded C# language version to 12 |
| MailKit/Security/*.cs | Added nullable annotations to SASL mechanism classes and SSL exception handling |
| MailKit/Net/**/*.cs | Added nullable annotations to networking, IMAP, POP3, and SMTP client classes |
| MailKit/*.cs | Added nullable annotations to core MailKit types like MessageSummary, Envelope, BodyPart classes |
| UnitTests/*.cs | Updated tests to use proper constructors for BodyPart types and adjusted assertions for non-null collections |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…rgument This removes the need to reference the `current` member variable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes issue #1972