Skip to content

Fix various analyzer errors#9292

Merged
glen-84 merged 4 commits intomainfrom
gai/fix-analyzer-errors
Mar 3, 2026
Merged

Fix various analyzer errors#9292
glen-84 merged 4 commits intomainfrom
gai/fix-analyzer-errors

Conversation

@glen-84
Copy link
Copy Markdown
Member

@glen-84 glen-84 commented Mar 3, 2026

Summary of the changes (Less than 80 chars)

  • Fix various analyzer errors.

Copilot AI review requested due to automatic review settings March 3, 2026 08:25
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 3, 2026

Fusion Gateway Performance Results

Progress: 3/6 benchmarks completed — this report updates as each job finishes.

Simple Composite Query

Req/s Err%
Constant 1 (50 VUs) 5162.17 0.00%
Ramping 1 (0-500-0 VUs) pending pending
Response Times
Min Med Avg P90 P95 Max
Constant 1 0.62ms 7.90ms 9.54ms 15.78ms 21.12ms 178.12ms
Ramping 1 pending pending pending pending pending pending

Deep Recursion Query

Req/s Err%
Constant 1 (50 VUs) pending pending
Ramping 1 (0-500-0 VUs) 1375.35 0.00%
Response Times
Min Med Avg P90 P95 Max
Constant 1 pending pending pending pending pending pending
Ramping 1 1.80ms 133.37ms 154.70ms 328.56ms 372.63ms 715.47ms

Variable Batching Throughput

Req/s Err%
Constant 1 (50 VUs) pending pending
Ramping 1 (0-500-0 VUs) 9386.47 0.00%
Response Times
Min Med Avg P90 P95 Max
Constant 1 pending pending pending pending pending pending
Ramping 1 0.10ms 21.18ms 24.59ms 46.20ms 64.55ms 166.94ms

Runner 1 = benchmarking-1

Run 22615474070 • Commit fd20f71 • Tue, 03 Mar 2026 09:04:10 GMT

Copy link
Copy Markdown
Contributor

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 PR focuses on resolving various analyzer warnings/errors across multiple projects (tests, CLI, and core libraries) by cleaning up unused code/usings, aligning naming/style with conventions, and applying newer C# syntax where appropriate.

Changes:

  • Remove unused using directives and unused private helpers/constructors flagged by analyzers.
  • Apply consistent naming/style tweaks (e.g., s_ prefix for private static fields, formatting adjustments).
  • Modernize a few initializations/usages (e.g., collection expressions [], simplified type references).

Reviewed changes

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

Show a summary per file
File Description
src/StrawberryShake/Client/test/Core.Tests/Serialization/AnySerializerTests.cs Simplifies JsonSerializer usage by relying on existing using System.Text.Json;.
src/Nitro/CommandLine/src/CommandLine/Commands/Fusion/FusionRunCommand.cs Changes ServeMode reference (currently appears to introduce an unresolved identifier).
src/HotChocolate/Fusion-vnext/test/Fusion.Execution.Tests/Planning/OperationPlannerBatchingGroupIdTests.cs Uses collection expressions and removes an unused helper method.
src/HotChocolate/Fusion-vnext/test/Fusion.Execution.Tests/Execution/Clients/SourceSchemaRequestDispatcherTests.cs Formatting-only change for property declaration.
src/HotChocolate/Fusion-vnext/test/Fusion.Diagnostics.Tests/ActivityTestHelper.cs Removes unused HotChocolate.Utilities using.
src/HotChocolate/Fusion-vnext/test/Fusion.AspNetCore.Tests/v15/DemoIntegrationTests.LegacyPorted.cs Renames endpoint field to s_graphQLEndpoint and updates usages.
src/HotChocolate/Fusion-vnext/test/Fusion.AspNetCore.Tests/SourceSchemaErrorTests.cs Minor formatting/style fix for array initialization spacing.
src/HotChocolate/Fusion-vnext/src/Fusion.Execution/Text/Json/SourceResultDocument.cs Removes unused System.Diagnostics using.
src/HotChocolate/Fusion-vnext/src/Fusion.Diagnostics/FusionActivityEnricher.cs Formatting fix in list-pattern property match spacing.
src/HotChocolate/Data/test/Data.Tests/QueryContextUnionProjectionTests.cs Renames private static test data fields to s_... and updates references.
src/HotChocolate/Data/test/Data.Tests/Issue5528ReproTests.cs Renames private static test data field to s_data and updates references.
src/HotChocolate/Data/test/Data.Filters.InMemory.Tests/Issue7110ReproTests.cs Removes unused System.Collections.Generic using.
src/HotChocolate/Data/test/Data.EntityFramework.Tests/Issue5449Tests.cs Removes a private constructor used for EF/service injection (appears behavior-breaking).
src/HotChocolate/Data/test/Data.EntityFramework.Tests/IntegrationTests.cs Removes constructors used for DbContext injection in entity test (appears behavior-breaking).
src/HotChocolate/Data/src/Data/Projections/Expressions/Handlers/QueryableProjectionScalarHandler.cs Removes unused System.Linq using and minor local typing simplification.
src/HotChocolate/Core/test/Types.Tests/Types/Scalars/Issue6197ReproTests.cs Removes unused System.Text.Json.Serialization using.
src/HotChocolate/Core/test/Types.Mutations.Tests/Issue6605ReproTests.cs Removes unused HotChocolate.Tests using.
src/HotChocolate/Core/src/Types/Utilities/JsonElementTypeChangeProvider.cs Removes unused System.Collections using.
src/HotChocolate/Core/src/Types/Types/Scalars/Scalars.cs Removes unused System.Collections using.
src/HotChocolate/Core/src/Types/Fetching/BatchDispatcher.cs Removes unused HotChocolate.Utilities using.
src/HotChocolate/Core/src/Types/Execution/Processing/Tasks/ResolverTask.cs Removes unused HotChocolate.Utilities using.
src/HotChocolate/Core/src/Types.Analyzers/Inspectors/ClassBaseClassInspector.cs Adjusts using static usage and StartsWith comparison to fix analyzer issues.
src/HotChocolate/Core/src/Subscriptions/DefaultTopic.cs Removes unused HotChocolate.Utilities using.
src/HotChocolate/Core/src/Subscriptions.Postgres/ContinuousTask.cs Removes unused HotChocolate.Utilities using (and blank line).
src/HotChocolate/AspNetCore/src/Transport.Sockets.Client/Protocols/GraphQLOverWebSocket/GraphQLOverWebSocketProtocolHandler.cs Removes unused HotChocolate.Utilities using.
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Subscriptions/OperationSession.cs Removes unused HotChocolate.Utilities using.
src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/Issue8756ReproTests.cs Removes unused HotChocolate.ApolloFederation.Types using.
Comments suppressed due to low confidence (2)

src/HotChocolate/Data/test/Data.EntityFramework.Tests/Issue5449Tests.cs:100

  • The _context field is never assigned anymore (the constructor that accepted Issue5449Context was removed), so ContextInjected will always be false. That breaks what this test is asserting (entity service injection during materialization). Re-introduce the constructor used for EF Core service injection (or update the entity/service injection mechanism so _context is set during materialization).
    public sealed class Issue5449Blog
    {
        private readonly Issue5449Context? _context;

        public Issue5449Blog()
        {
            Name = string.Empty;
        }

        public Issue5449Blog(string name)
        {
            Name = name;
        }

        public int Id { get; set; }

        public string Name { get; set; }

        [NotMapped]
        public bool ContextInjected => _context is not null;
    }

src/HotChocolate/Data/test/Data.EntityFramework.Tests/IntegrationTests.cs:684

  • ConstructorInjectionBlog.Context can no longer be set (the constructor that accepted ConstructorInjectionDbContext was removed and the property is getter-only), so PostCount will always evaluate to 0. This undermines the purpose of AsSelector_Should_Preserve_Entity_Constructor_DbContext_Injection() and should cause the assertions to fail. Restore the constructor-based DbContext injection (or change the pattern so EF can populate Context during entity materialization).
    public class ConstructorInjectionBlog
    {
        private ConstructorInjectionDbContext? Context { get; }

        public int Id { get; set; }

        public string Name { get; set; } = default!;

        public int PostCount => Context?.Posts.Count() ?? 0;
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@glen-84 glen-84 merged commit a27298b into main Mar 3, 2026
121 of 124 checks passed
@glen-84 glen-84 deleted the gai/fix-analyzer-errors branch March 3, 2026 09:05
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (e9dda60) to head (239d769).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff      @@
##   main   #9292   +/-   ##
============================
============================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants