Skip to content

Comments

Added nullability attributes to the API#1983

Merged
jstedfast merged 45 commits intomasterfrom
nullability-api
Feb 24, 2026
Merged

Added nullability attributes to the API#1983
jstedfast merged 45 commits intomasterfrom
nullability-api

Conversation

@jstedfast
Copy link
Owner

Fixes issue #1972

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.
@coveralls
Copy link

Coverage Status

coverage: 0.0% (-92.9%) from 92.887%
when pulling adfebe6 on nullability-api
into a2766da on master.

@jstedfast jstedfast merged commit ad56fe1 into master Feb 24, 2026
11 checks passed
@jstedfast jstedfast deleted the nullability-api branch February 24, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants