-
-
Notifications
You must be signed in to change notification settings - Fork 396
Open
Labels
Description
I have a .NET Framework client application that uses Flurl.Http. After upgrading to Flurl v4 this application now tries to load the System.Text.Json assembly, even though I use Flurl.Http.Newtonsoft.
Please make it so that System.Text.Json is not needed if Flurl.Http.Newtonsoft is used. Otherwise I'd have to deploy System.Text.Json assemblies (and the whole dependency tree that comes with it, which is huge!) to my clients even though it wouldn't (shouldn't) be used.
Sample (compile with <TargetFramework>net48</TargetFramework>):
static async Task Main()
{
// Place a breakpoint here and delete all System.* assemblies in the bin folder before continuing.
FlurlHttp.Clients.UseNewtonsoft();
// Use the debugger to analyze the exception because 'ex.ToString()' also throws an exception itself for some reason...
var result = await "https://some-api.com".GetStringAsync();
}Exception:
System.TypeInitializationException: 'The type initializer for 'Flurl.Http.Configuration.FlurlHttpSettings' threw an exception.'
at Flurl.Http.Configuration.FlurlHttpSettings.<<Get>g__prioritize|26_0>d`1.MoveNext()
at Flurl.Http.Configuration.FlurlHttpSettings.Get[T](String propName)
at Flurl.Http.Configuration.FlurlHttpSettings.get_HttpVersion()
at Flurl.Http.FlurlClient.<SendAsync>d__23.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Flurl.Http.ResponseExtensions.<ReceiveString>d__1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at ConsoleApp2.Program.<Main>d__0.MoveNext() in C:\Daten\Projekte\ConsoleApp2\ConsoleApp2\Program.cs:line 18
Inner exception:
System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Text.Json, Version=6.0.0.4, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.'
at Flurl.Http.Configuration.DefaultJsonSerializer..ctor(JsonSerializerOptions options)
at Flurl.Http.Configuration.FlurlHttpSettings..cctor()
Metadata
Metadata
Assignees
Labels
Projects
Status
Backlog