Skip to content

Maintenance: migrate to slnx and Central Package Management, and modernize tests #469

Open

Description

@aetos382

Summary

I'd like to do a round of housekeeping on the build and test infrastructure:

  • migrate to .slnx and Central Package Management
  • replace FluentAssertions and move to xUnit v3
  • add test coverage for the netstandard build and for wire-format compatibility

The same kind of work is proposed for ZLogger in Cysharp/ZLogger#249. None of this changes the shipped packages.

Updating the TFMs for the .NET 8 / .NET 9 end of support is deliberately left out. In MemoryPack it is more involved than in other libraries, because the netstandard2.1 build and the net* builds are not compatible with each other (see "Target framework dependency" in the README), so I'd like to discuss it in a separate issue. The tests below are meant to be in place before that work starts.

Before opening PRs, I'd appreciate feedback, especially on the open questions at the end.

Tasks

Solution and packages

  • Replace MemoryPack.sln with MemoryPack.slnx. CI runs dotnet build / test / pack without a solution path, and already uses a .NET 10 SDK, so no workflow changes are expected.
  • Adopt Central Package Management (Directory.Packages.props), as MagicOnion, GrpcWebSocketBridge, Multicaster, and DFrame already do. Once test: run tests against the netstandard2.1 build #468 is merged, the two test projects share the same package list. This doesn't affect Unity, which doesn't read the project files.

Tests

  • Run the existing tests against the netstandard2.1 build, which Unity uses (test: run tests against the netstandard2.1 build #468). Today, the #else side of #if NET7_0_OR_GREATER / NET8_0_OR_GREATER is never tested.
  • Add wire-format compatibility tests: commit the bytes produced by 1.21.4 for representative types, and check in both test projects that serializing gives the same bytes and deserializing gives the original values. See open question 2.
  • Replace FluentAssertions with Shouldly. FluentAssertions 8 and later require a commercial license, and ConsoleAppFramework, R3, GrpcWebSocketBridge, MasterMemory, and DFrame have already moved. This is about 430 assertions in 39 files, rewritten by hand.
  • Migrate from xUnit v2 to xUnit v3 on Microsoft.Testing.Platform, the same setup as R3 and ZLinq.
  • Update the remaining test packages.

The first two should also be in place before #460, which changes code that runs in the netstandard2.1 build too.

Out of scope

Each of these would be a separate issue if we want to pursue it.

  • Updating the TFMs and library dependencies for the .NET 8 / .NET 9 end of support (2026-11-10). This involves the source generator, consumers on dropped runtimes, Add allows ref struct constraint to TBufferWriter for .NET 9+ #448, and possibly a future redesign of the buffer layer, so it deserves its own discussion.
  • Generator tests for other language versions. The tests compile generated code only with C# 11, while Unity users get the C# 9 output by default.
  • Running tests on net48 (Windows CI).

Open questions

  1. Test stack. Is Shouldly + xUnit v3 (Microsoft.Testing.Platform) the preferred standard for Cysharp repositories going forward? Similarly, should Central Package Management become the default?
  2. Wire-format compatibility. The new tests would enforce these rules. Do they sound right?

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions