Skip to content

Add null checks#14

Merged
centeredgebot[bot] merged 3 commits into
mainfrom
null-preconditions
Sep 29, 2025
Merged

Add null checks#14
centeredgebot[bot] merged 3 commits into
mainfrom
null-preconditions

Conversation

@brantburnett
Copy link
Copy Markdown
Contributor

Motivation

Better exceptions with preconditions.

Modifications

Add a ThrowHelper for .NET < 6 and then use it or
ArgumentNullException.ThrowIfNull.

Motivation
----------
Better exceptions with preconditions.

Modifications
-------------
Add a ThrowHelper for .NET < 6 and then use it or
ArgumentNullException.ThrowIfNull.
Copy link
Copy Markdown

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 null checks for better exception handling with preconditions across the CenterEdge.Async library. The changes implement null validation for parameters in public API methods using framework-appropriate approaches.

  • Creates a custom ThrowHelper class for .NET versions prior to 6.0
  • Adds comprehensive null checks to all public RunSync methods in AsyncHelper
  • Implements conditional compilation to use ArgumentNullException.ThrowIfNull for .NET 6+ or custom helper for older versions

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
ThrowHelper.cs New internal helper class for throwing ArgumentNullException in pre-.NET 6 frameworks
CenterEdge.Async.csproj Build configuration to exclude ThrowHelper.cs when targeting .NET 6+
ExclusiveSynchronizationContext.cs Adds null check for callback parameter in Post method
AsyncHelper.cs Adds null checks to all six RunSync method overloads

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/CenterEdge.Async/ExclusiveSynchronizationContext.cs Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Brant Burnett <bburnett@centeredgesoftware.com>
@brantburnett brantburnett marked this pull request as ready for review September 29, 2025 15:25
RobRobertsCE
RobRobertsCE previously approved these changes Sep 29, 2025
Comment thread src/CenterEdge.Async/ExclusiveSynchronizationContext.cs
@brantburnett
Copy link
Copy Markdown
Contributor Author

/merge

@centeredgebot centeredgebot Bot merged commit 90c3d91 into main Sep 29, 2025
6 checks passed
@centeredgebot centeredgebot Bot deleted the null-preconditions branch September 29, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants