GeneratorConsumer: check the generated formatter behind the guard's wrapper (CultUnionGuard.Inner)
The check that each document type runs MessagePack's source-generated formatter saw the guard's SlotFormatter and exited 1 (Soul s3 generator-consumer-check-red). The guard owns the one unwrap, internal, visible to the consumer through InternalsVisibleTo; that also exposes the library's internal GeneratedMessagePackResolver, so the consumer suppresses CS0436 (its own is the type used). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f3b62a7ee7
commit
3cbb744f91
4 changed files with 21 additions and 3 deletions
|
|
@ -20,7 +20,8 @@ var documents = new (Type Type, object Value)[]
|
|||
|
||||
foreach (var (type, _) in documents)
|
||||
{
|
||||
var formatter = options.Resolver.GetFormatterDynamic(type)!.GetType();
|
||||
// The guard wraps a measured type's formatter; the generated formatter it delegates to is the one that runs.
|
||||
var formatter = CultUnionGuard.Inner(options.Resolver.GetFormatterDynamic(type)!).GetType();
|
||||
if (formatter.Assembly.IsDynamic || !(formatter.FullName ?? "").Contains("GeneratedMessagePackResolver"))
|
||||
return Fail($"{type.Name} is formatted by {formatter.FullName}, not a generated formatter");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue