Skip to content

Build failure: CS8795 with dotnet 9.x - analyzer version mismatch #970

Description

@M-r-A

The build fails on all .NET 9.0.x SDKs with CS8795 (partial method without implementation) due to an analyzer version incompatibility introduced in commit 075ab81.

Summary

SourceGen.csproj depends on Microsoft.CodeAnalysis.CSharp 5.3.0, which requires Roslyn 5.3.0+. However:

  • .NET SDK 9.0.x bundles Roslyn 4.14.0 ❌ (too old)
  • .NET SDK 10.0.302+ bundles Roslyn 5.3.0+ ✓ (compatible)

The build workflow specifies dotnet-version: 9.x, so it triggers the mismatch locally for anyone building on 9.0.x.

Steps to Reproduce

# On any .NET 9.0.x SDK (e.g., 9.0.315, 9.0.316):
dotnet build Source/Multiplayer.sln

Expected Behavior

Build succeeds with warnings only.

Actual Behavior

CSC : warning CS9057: Analyzer assembly 'SourceGen.dll' cannot be used because 
      it references version '5.3.0.0' of the compiler, which is newer than the 
      currently running version '4.14.0.0'.

D:/.../ChatCommandRegistry.cs(18,32): error CS8795: Partial method 
  'ChatCommandRegistry.Register(ChatCommandManager, MultiplayerServer)' 
  must have an implementation part because it has accessibility modifiers.

Build FAILED.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions