fix: use minimum 6.0.0 System.Text.Json version#2720
Conversation
|
@campersau seems like a bug in .NET Azure Functions to me in the way how they bundle their assemblies. (they don't publish a custom System.Text.Json package). Curious about your input here. |
|
The problem is that the AzureFunctionsTools which hosts the local functions does include the In .NET Framework you can work around that by using AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
private Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
var name = new AssemblyName(args.Name);
var dll = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, name.Name + ".dll");
if (File.Exists(dll))
{
return Assembly.LoadFrom(dll);
}
return null;
}E.g. .NET will try to load In my opinion libraries should always try to use the lowest dependency version possible since the users can then "override" it by specifying it explicitly in their project. * This of course only works at runtime if there aren't any breaking changes which Playwirght uses. I am not sure what #2408 was about exactly as there isn't enough information for me to reproduce it, maybe there are other solutions for this too. |
|
Thanks for your great investigation! 💯
From my experiments System.Text.Json was not included in the zip which got uploaded to the Azure Function.
Yeah for me it also wasn't clear anymore, I made a quick .NET 7 test where it looked good. I guess I'll merge this for now (which is like a revert of #2410 so it should be fine). Thanks again! |
This does it like the Azure CLI folks: https://github.com/Azure/azure-sdk-for-net/blob/ff337a1ce38c57f770d28a36198d90ad7be27f80/sdk/digitaltwins/Azure.DigitalTwins.Core/samples/DigitalTwinsClientSample/DigitalTwinsClientSample.csproj#L21
But this most likely will regress #2408 since it reverts #2410, requires testing.
Fixes #2696