Skip to content

Commit 2cf40f2

Browse files
committed
fix
1 parent afcdfa7 commit 2cf40f2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

sandbox/GeneratorSandbox/Program.cs

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
//using Microsoft.Extensions.Options;
1111
//using ZLogger;
1212

13+
14+
1315
//args = ["echo", "--msg", "zzzz"];
1416

1517
//// IHostBuilder
@@ -145,6 +147,11 @@ namespace ConsoleAppFramework
145147
{
146148
internal static partial class ConsoleApp
147149
{
150+
static void Foo()
151+
{
152+
var options = JsonSerializerOptions ?? System.Text.Json.JsonSerializerOptions.Default;
153+
}
154+
148155
//public static ConsoleAppBuilder Create(IServiceProvider serviceProvider)
149156
//{
150157
// ConsoleApp.ServiceProvider = serviceProvider;

src/ConsoleAppFramework/ConsoleAppBaseCode.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ static bool TrySplitParse<T>(ReadOnlySpan<char> s, out T[] result)
228228
{
229229
try
230230
{
231-
var type = (System.Text.Json.Serialization.Metadata.JsonTypeInfo<T[]>)JsonSerializerOptions.GetTypeInfo(typeof(T))!;
231+
var options = JsonSerializerOptions ?? System.Text.Json.JsonSerializerOptions.Default;
232+
var type = (System.Text.Json.Serialization.Metadata.JsonTypeInfo<T[]>)options.GetTypeInfo(typeof(T[]))!;
232233
result = System.Text.Json.JsonSerializer.Deserialize<T[]>(s, type)!;
233234
return true;
234235
}

0 commit comments

Comments
 (0)