Exception thrown: 'System.FormatException' in Newtonsoft.Json.dll
Detailed logs from a console application written to identify the line:
Exception occurred: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
Stack trace
at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
at System.Convert.FromBase64CharArray(Char[] inArray, Int32 offset, Int32 length)
at Newtonsoft.Json.JsonTextReader.ParseReadString(Char quote, ReadType readType)
at Newtonsoft.Json.JsonTextReader.ParseString(Char quote, ReadType readType)
at Newtonsoft.Json.JsonTextReader.ReadAsBytes()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
at Microsoft.Azure.Devices.Client.DefaultPayloadConvention.GetObject[T](String jsonObjectAsText)
at Microsoft.Azure.Devices.Client.DefaultPayloadConvention.GetObject[T](Byte[] objectToConvert)
at Microsoft.Azure.Devices.Client.DirectMethodRequest.GetPayload()
Context
Description of the issue
GetPayload()
onDirectMethodRequest
results in a JSON Format Exception.Code sample exhibiting the 1st issue
Console log of the 1st issue
Exception thrown: 'System.FormatException' in Newtonsoft.Json.dll
Detailed logs from a console application written to identify the line:
Output of twin json
vs output of Desired