Closed liamfl closed 5 years ago
With netcoreapp2.2 I am getting the following exception:
System.MissingMethodException: 'Method not found: 'Int32 System.Text.Encodings.Web.TextEncoder.FindFirstCharacterToEncodeUtf8(System.ReadOnlySpan`1<Byte>)'.'
Stack:
at System.Text.Json.JsonWriterHelper.NeedsEscaping(ReadOnlySpan1 value, JavaScriptEncoder encoder) at System.Text.Json.JsonPropertyInfo.DeterminePropertyName() at System.Text.Json.JsonPropertyInfo.GetPolicies() at System.Text.Json.JsonPropertyInfoCommon
4.Initialize(Type parentClassType, Type declaredPropertyType, Type runtimePropertyType, Type implementedPropertyType, PropertyInfo propertyInfo, Type elementType, JsonConverter converter, JsonSerializerOptions options)
at System.Text.Json.JsonClassInfo.CreateProperty(Type declaredPropertyType, Type runtimePropertyType, Type implementedPropertyType, PropertyInfo propertyInfo, Type parentClassType, JsonConverter converter, JsonSerializerOptions options)
at System.Text.Json.JsonClassInfo.AddProperty(Type propertyType, PropertyInfo propertyInfo, Type classType, JsonSerializerOptions options)
at System.Text.Json.JsonClassInfo..ctor(Type type, JsonSerializerOptions options)
at System.Text.Json.JsonSerializerOptions.GetOrAddClass(Type classType)
at System.Text.Json.JsonSerializer.ReadValueCore(Utf8JsonReader& reader, Type returnType, JsonSerializerOptions options)
at System.Text.Json.JsonSerializer.Deserialize[TValue](Utf8JsonReader& reader, JsonSerializerOptions options)
at IotProcessor.IoTHubProcessorFunction.Deserialize(ArraySegment`1 data) in C:[]path\Function.cs:line 53
Repro
var bytes = Encoding.UTF8.GetBytes("{\"R\":\"current\", \"T\": 22.9}");
var d = JsonSerializer.Deserialize<DeviceRequestMessage>(bytes.AsSpan());
Same here, getting:
[2019-10-06 19:15:23] System.Private.CoreLib: Exception while executing function: IndexNuGetPackages. PublicAPI.Functions: Could not load file or assembly 'System.Text.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified. System.Private.CoreLib: Could not load the specified file.
Targeting netcoreapp3.0
in my csproj
Seems like Azure Functions doesn't support netcore 3.0 yet https://github.com/Azure/app-service-announcements/issues/200 so that seems like the likely explanation :)
@andreasohlund is correct. This is expected until you're running against the runtime tracked by the announcement made here: Azure/app-service-announcements#200
Please continue to follow that announcement for updates.
I am trying to implement a function that uses .net core 3 (preview 9) as a target framework and uses the new System.text.json namespace. Here is my code:
When I run the code and submit a message onto the service bus queue, the function is triggered but fails with the following error:
I'm coming to the conclusion that I will have to downgrade my project to .net core 2.2, which will cause a fair amount of work as I have a web project up and running using the new codebase.