4

My azure functions is in .net core 3.1 v3 and I had a problem trying to publish using VS2019/22 on Linux app service but works fine if i choose Windows app service. I am not sure why it is complaning something about Newtonsoft.Json, I use the version 13.0.1 and It should be supported by Sdk version as well.

I have tried all possible bin, obj, nuget cache, temp to delete, restarted VS, ran VS in Admin mode but nothing helped.

Finally tried VS Code and publish went smooth. What is the deal here with VS unless there is bug was introduced. Because my last publish was at the end of the march with same project and I compared changes and even tried to back to a last published commit but still was same error. Any idea here?

Error I am getting

2>Uploaded the Zip file to the target.
2>Polling for deployment status...
2>The "ZipDeployTask" task failed unexpectedly.
2>System.AggregateException: One or more errors occurred. ---> Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: {. Path 'build_summary', line 1, position 478.
2>   at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)
2>   at Newtonsoft.Json.JsonTextReader.ReadAsString()
2>   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
2>   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id)
2>   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
2>   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
2>   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
2>   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
2>   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
2>   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
2>   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
2>   at Microsoft.NET.Sdk.Functions.MSBuild.Tasks.ZipDeploymentStatus.<InvokeGetRequestWithRetryAsync>d__11`1.MoveNext()
2>--- End of stack trace from previous location where exception was thrown ---
Emil
  • 6,411
  • 7
  • 62
  • 112
  • FWIW, I have the same issue today. .NET 3.1 Function App deploying to Linux plan - previously succeeded (end of April), and failing with this error today - tried VS update, tried multiple dev machines - all hit the same error. Like you say, all OK via VS Code. – AdaTheDev May 09 '22 at 12:01
  • @AdaTheDev this is crazy. it wasted my hours yesterday. It should be a VS bug I would say but it also works using Windows app service, just failing with Linux. I couldnt find a bug report for that. Maybe better to report on github. I would do later when I have time. – Emil May 09 '22 at 13:25
  • 3
    FYI, I've logged an issue here: https://github.com/Azure/Azure-Functions/issues/2207 – AdaTheDev May 10 '22 at 11:35

2 Answers2

2

In case anyone else hits this issue and finds this Q....

Full details of this bug are in: https://github.com/Azure/azure-functions-vs-build-sdk/issues/556

This has now been resolved in v4.1.1 of Microsoft.Net.Sdk.Functions, and also backported to v3.1.1. Updating the package ref in your Azure Function project should sort it.

AdaTheDev
  • 142,592
  • 28
  • 206
  • 200
0

System.AggregateException: One or more errors occurred. --->
Newtonsoft.Json.JsonReaderException: Unexpected character encountered
while parsing value: {. Path 'build_summary', line 1, position 478.

  • Usually, these types of issues may occur if you are not passing the JSON object to Deserialized object.

at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id)

  • JsonConvert.DeserializeObject will take the JSON value not the file path. Check your code once that are you providing file path or the Json value on the deserializer object.

  • For More information you can go through the SO thread with related discussions.

SaiSakethGuduru
  • 2,218
  • 1
  • 5
  • 15
  • That error message isn't in my source code. It is from azure. See the issue github link in comment. It is a bug on azure – Emil Jun 04 '22 at 13:29