Skip to content

Commit

Permalink
more fix
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Nov 24, 2023
1 parent 848f059 commit a28d249
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion sandbox/GeneratorSandbox/GeneratorSandbox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<ItemGroup>
<ProjectReference Include="..\..\src\ZLogger\ZLogger.csproj" />
<ProjectReference Include="..\..\ZLogger.Generator\ZLogger.Generator\ZLogger.Generator.csproj">
<ProjectReference Include="..\..\src\ZLogger.Generator\ZLogger.Generator.csproj">
<OutputItemType>Analyzer</OutputItemType>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
Expand Down
16 changes: 11 additions & 5 deletions src/ZLogger/Internal/MagicalBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,17 @@ static void ThrowArgumentOutOfRangeException()

static class ReaderCache
{
readonly record struct Handlers(
delegate* managed<MagicalBox, int, Utf8JsonWriter, JsonSerializerOptions?, bool> Utf8JsonWriter,
delegate* managed<MagicalBox, int, ref DefaultInterpolatedStringHandler, int, string?, bool> StringHandler, // box, offset, handler, alignment, format
delegate* managed<MagicalBox, int, ref Utf8StringWriter<IBufferWriter<byte>>, int, string?, bool> Utf8StringWriter,
delegate* managed<MagicalBox, int, object?> ReadBoxed);
sealed class Handlers(
delegate* managed<MagicalBox, int, Utf8JsonWriter, JsonSerializerOptions?, bool> utf8JsonWriter,
delegate* managed<MagicalBox, int, ref DefaultInterpolatedStringHandler, int, string?, bool> stringHandler, // box, offset, handler, alignment, format
delegate* managed<MagicalBox, int, ref Utf8StringWriter<IBufferWriter<byte>>, int, string?, bool> utf8StringWriter,
delegate* managed<MagicalBox, int, object?> readBoxed)
{
public readonly delegate* managed<MagicalBox, int, Utf8JsonWriter, JsonSerializerOptions?, bool> Utf8JsonWriter = utf8JsonWriter;
public readonly delegate* managed<MagicalBox, int, ref DefaultInterpolatedStringHandler, int, string?, bool> StringHandler = stringHandler;
public readonly delegate* managed<MagicalBox, int, ref Utf8StringWriter<IBufferWriter<byte>>, int, string?, bool> Utf8StringWriter = utf8StringWriter;
public readonly delegate* managed<MagicalBox, int, object?> ReadBoxed = readBoxed;
}

static readonly ConcurrentDictionary<Type, Handlers> cache = new();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<ItemGroup>
<ProjectReference Include="..\..\src\ZLogger\ZLogger.csproj" />
<ProjectReference Include="..\..\ZLogger.Generator\ZLogger.Generator\ZLogger.Generator.csproj" />
<ProjectReference Include="..\..\src\ZLogger.Generator\ZLogger.Generator.csproj" />
</ItemGroup>

</Project>

0 comments on commit a28d249

Please sign in to comment.