A direct MessagePackAnalyzer reference with PrivateAssets="all" in
Caching.MessagePack and Networking keeps MessagePack 3's generator out of
consumer builds, where it emitted a reference to a nonexistent
GeneratedMessagePackResolver formatter for Dictionary<CultRecordRef<T>, float>
(CS0426). CultLib composes StandardResolver itself and never registers a
generated resolver.
tests/GameCult.Caching.ConsumerBuild is RefKeyedDictionaryCompilesInAConsumer:
its build is the test. On 825b4f7 it failed with CS0426; now it builds and
obj has no MessagePack.SourceGenerator output.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
14 lines
525 B
C#
14 lines
525 B
C#
using System.Collections.Generic;
|
|
using GameCult.Caching;
|
|
using MessagePack;
|
|
|
|
// RefKeyedDictionaryCompilesInAConsumer: this project building is the test.
|
|
System.Console.WriteLine(new ConsumerFaction().Standing.Count);
|
|
|
|
[CultDocument("tests.consumer_faction", "tests.consumer_faction.v1")]
|
|
[MessagePackObject]
|
|
public sealed class ConsumerFaction
|
|
{
|
|
[Key(0)] [CultName] public string Name { get; set; } = string.Empty;
|
|
[Key(1)] public Dictionary<CultRecordRef<ConsumerFaction>, float> Standing { get; set; } = new();
|
|
}
|