Skip to content

Commit 9b0e2db

Browse files
feat: allow users to still use static constructors
1 parent 9aa51ce commit 9b0e2db

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/MemoryPack.Generator/MemoryPackGenerator.Emitter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,9 +941,12 @@ string EmitUnionTemplate(IGeneratorContext context)
941941
942942
partial {{classOrInterfaceOrRecord}} {{TypeName}} : IMemoryPackFormatterRegister
943943
{
944+
static partial void StaticConstructor();
945+
944946
static {{Symbol.Name}}()
945947
{
946948
{{register}}
949+
StaticConstructor();
947950
}
948951
949952
[global::MemoryPack.Internal.Preserve]

0 commit comments

Comments
 (0)