Skip to content

[code-simplifier] Use is not null instead of != null in new files from PR #10353 #10361

Closed

Description

@github-actions

Code Simplification — 2026-07-31

This PR applies a targeted fix to two files introduced in #10353 that use != null instead of is not null, violating the project's coding standards.

Files Simplified

  • src/Platform/Microsoft.Testing.Extensions.MSBuild/MSBuildConsumer.cs — replaced 4 != null usages with is not null
  • src/Platform/Microsoft.Testing.Platform/ServerMode/JsonRpc/SerializerUtilities.TestNodeSerializers.cs — replaced 5 != null usages with is not null

Improvements Made

Applied Project Standards

  • The .editorconfig and codebase convention require is not null / is null instead of != null / == null for null checks
  • The same pattern (ApplicationStateGuard.Ensure(x is not null)) is consistently used across all other Platform source files
  • Both files were newly created in Report MSTest assertion expected/actual through a platform property #10353 and introduced the inconsistency

Changes Based On

Recent changes from:

Testing

  • ✅ No functional changes — semantics of is not null and != null are identical for these reference types
  • ✅ Purely cosmetic/style fix, no behavior change possible
  • ✅ Consistent with existing patterns across all other files in the same projects

Review Focus

Please verify:

  • Conventions are now consistent with the rest of the Platform codebase
  • No unintended side effects (there are none — these are style-only changes)

🤖 Automated content by GitHub Copilot. Generated by the Code Simplifier workflow. · sonnet46 173.3 AIC · ⌖ 15.3 AIC · ⊞ 9.9K · [◷]( · ◷)

Add this agentic workflow to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/code-simplifier.md@main
  • expires on Aug 1, 2026, 1:51 PM UTC

Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch code-simplifier/fix-null-checks-2026-07-31-4fcb7029c0fc7b7f.

Click here to create the pull request

To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (98 of 98 lines)
From 0e4173da3842a1051dcae87bc2f62682abfd7823 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Fri, 31 Jul 2026 13:49:15 +0000
Subject: [PATCH] Use 'is not null' instead of '!= null' in new files from PR
 #10353

Replace != null comparisons with 'is not null' pattern matching in
MSBuildConsumer.cs and SerializerUtilities.TestNodeSerializers.cs,
both newly added in PR #10353.

This aligns with the project coding standards enforced across the
Platform codebase.

Co-authored-by: Copilot <[email protected]>
---
 .../MSBuildConsumer.cs                                 |  8 ++++----
 .../JsonRpc/SerializerUtilities.TestNodeSerializers.cs | 10 +++++-----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/Platform/Microsoft.Testing.Extensions.MSBuild/MSBuildConsumer.cs b/src/Platform/Microsoft.Testing.Extensions.MSBuild/MSBuildConsumer.cs
index c928b46..eef9564 100644
--- a/src/Platform/Microsoft.Testing.Extensions.MSBuild/MSBuildConsumer.cs
+++ b/src/Platform/Microsoft.Testing.Extensions.MSBuild/MSBuildConsumer.cs
@@ -200,8 +200,8 @@ private async Task HandleFailuresAsync(string testDisplayName, bool isCanceled,
     {
         _totalTests++;
         _totalFailedTests++;
-        ApplicationStateGuard.Ensure(_msBuildTestApplicationLifecycleCallbacks != null);
-        ApplicationStateGuard.Ensure(_msBuildTestApplicationLifecycleCallbacks.PipeClient != null);
+        ApplicationStateGuard.Ensure(_msBuildTestApplicationLifecycleCallbacks is not null);
+        ApplicationStateGuard.Ensure(_msBuildTestApplicationLifecycleCallbacks.PipeClient is not null);
         var failedTestInfoRequest = new FailedTestInfoRequest(testDisplayName, isCanceled, duration, errorMessage, errorStackTrace, expected, actual, codeFilePath, lineNumber);
         await _msBuildTestApplicationLifecycleCallbacks.PipeClient.RequestReplyAsync<FailedTestInfoRequest, VoidResponse>(failedTestInfoRequest, canc
... (truncated)

Activity

  1. added
    type/tech-debt
    type/automation
    on Jul 31, 2026
  2. added
    area/agentic-workflows
    on Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/agentic-workflowstype/automationtype/tech-debt

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions