Relatório SmartView

Estou com problema em um relatório de smartview.

Percebi que o problema está no campo descrição da natureza, que deve ter algum caracter que o json está se perdendo.

Alguem sabe como posso resolver isso?

Segue erro.

DevExpress.XtraReports.DataRetrievalException: Error when trying to populate the datasource. The following exception was thrown: Exception has been thrown by the target of an invocation. —> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.Text.Json.JsonException: The JSON value could not be converted to System.Dynamic.ExpandoObject. Path: $[10].ED_DESCRIC | LineNumber: 0 | BytePositionInLine: 7156. —> System.InvalidOperationException: Cannot transcode invalid UTF-8 JSON text to UTF-16 string. —> System.Text.DecoderFallbackException: Unable to translate bytes [C7] at index 19 from specified code page to Unicode. at System.Text.DecoderExceptionFallbackBuffer.Throw(Byte bytesUnknown, Int32 index) at System.Text.DecoderExceptionFallbackBuffer.Fallback(Byte bytesUnknown, Int32 index) at System.Text.Encoding.GetCharCountWithFallback(ReadOnlySpan1 bytes, Int32 originalBytesLength, DecoderNLS decoder) at System.Text.Encoding.GetCharCountWithFallback(Byte* pBytesOriginal, Int32 originalByteCount, Int32 bytesConsumedSoFar) at System.Text.Json.JsonReaderHelper.TranscodeHelper(ReadOnlySpan1 utf8Unescaped) — End of inner exception stack trace — at System.Text.Json.JsonReaderHelper.TranscodeHelper(ReadOnlySpan1 utf8Unescaped) at System.Text.Json.Utf8JsonReader.GetString() at TReports.Provider.Connectors.Native.Parsers.ObjectAsPrimitiveConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) in /source/src/Provider.Connectors.Native/Parsers/ObjectAsPrimitiveConverter.cs:line 35 at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonDictionaryConverter3.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TDictionary& value) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonCollectionConverter2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options,

2 curtidas

Se você tem controle sobre a geração do JSON no SmartView, pode tentar converter a coluna para string antes da serialização:

if (registro[“ED_DESCRIC”] == null)
{
registro[“ED_DESCRIC”] = “”;
}
else
{
registro[“ED_DESCRIC”] = registro[“ED_DESCRIC”].ToString();
}

1 curtida

@dilsoncastro não sou eu que estou gerando o json, é o própio smartview.