question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"invalid start of a value" when trying to translate

See original GitHub issue

Describe the bug We’ve are using the package in our WinForm app using Telerik 2023.2.60653, .Net Framework 4.7.2, package latest 1.7.1 I have developed a feature where a user can select which language it wants to translate to, in our case English or Hungarian Lets say we have posts, and each post can have comments, when the user wants to translate, we translate all the comments. When translating to English it goes well, no problem, but when I want to translate to Hungarian (does not matter if the original language is Hungarian or not) I get the error showed below. Whether I translate to English first or second I get the same result I’ve been trying to reproduce the problem in a console app, but simply unable to do so, even our users have different experience, some reported that they get the error on the first try. We use HTML to display the comments, we use CefSharp to display a chromium browser inside the WinForm app.

Update 1: For me it does not matter if I do translate fast with 1-2 secs between the two requests or wait 1-2 minutes, basically every second request gets this error, whether I start with English or Hungarian. My colleagues experience difference if they wait a certain amount of time or not. I’ve tried to make demos which I could upload here making your jobs easier, but I can not make it fail… Somehow it fails in our app, but when I make a mini environment which represents our app, with the same code which makes the API call, I cant make it to fail as it does in our app

Expected behavior We get back the translation no problem

  • Stack trace:

at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex) at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.<ReadAsync>d__201.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at DeepL.Internal.JsonUtils.<DeserializeAsync>d__41.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at DeepL.Internal.JsonUtils.<DeserializeAsync>d__31.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at DeepL.Translator.<TranslateTextAsync>d__8.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Our class which inherits from UserControl.<TranslateCommentList>d__114.MoveNext() in the line of our cs file

  • Source:

System.Text.Json

  • Path:

$

  • Message:

‘<’ is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.

Screenshots or sample code

private void button_click(object sender, EventArgs e)
{
        RadButton translateButton = (RadButton)sender;
        if (translateButton == null) return;

        string targetLanguage = translateButton.Name == "translateToHungarianButton" ? LanguageCode.Hungarian : LanguageCode.EnglishAmerican;
        string sourceLanguage = targetLanguage == LanguageCode.Hungarian ? "EN" : "HU";
        Task.Run(async () => await TranslateText(commentList, sourceLanguage ,targetLanguage ));
}
private async Task TranslateText(string[] textsToTranslate, string sourceLanguage, string targetLanguage)
{
        TextResult[] translatedTexts;
        try
        {
                translatedTexts = await translator.TranslateTextAsync(textsToTranslate, sourceLanguage, targetLanguage, new TextTranslateOptions() { TagHandling = "xml", IgnoreTags = { "a" }, PreserveFormatting = true });
        }
        catch (Exception e)
        {
                MessageBox.Show($"Error: {e}");
                throw;
        }
}

If you guys need any more info please let me know! The problem could be solved with an easy fix, it might be my lack of knowledge

Issue Analytics

  • State:closed
  • Created 3 months ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
BenceBordascommented, Jul 4, 2023

Hey! Seems like you were right about the firewall! Talked to our IT guys and seems like we had to add an “application site category” and had to allow it(?) It was not allowed in the firewall on the application layer. To be honest our IT guy talked about it briefly and I don not have too much knowledge in this specific area so I hope it says something to you! For us this will be a solution, so I guess this issue is solved!

0reactions
JanEbbingcommented, Jul 4, 2023

Could it be from this: UserCheck ? I’m not aware DeepL uses this, so it might be on your side, the WebApp seems to call itself UserCheck and this was the main thing google could find. (There are also a lot of PORTAL_IS strings, but I don’t think they mean anything)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error on Build: JsonException: '0x00' is an invalid start of a ...
When I try to build my project I'm getting this error.... JsonException: '0x00' is an invalid start of a value. Path: $ |...
Read more >
The method 'Translate' has an invalid value for pa...
Pop-up error displays at startup for a few seconds but everything works fine. Nothing on edit mode. I tried both "fr" and "FR"...
Read more >
ant - CustomObjectTranslation invalid characters
I'm trying to use Ant to deploy some changes to a sandbox that has been updated to Winter '22. I'm getting 2 errors...
Read more >
Invalid Value (EasyTranslate::EasyTranslateException) #286
When trying to i18n-tasks translate-missing with locales with region (like es-ES or en-US ), the following error rises: /usr/local/rvm/gems/ruby ...
Read more >
Invalid translation language specified. [#2137815]
Tried translating a content that already was in two languages to a third language (spanish). No issue there, not able to reproduce his...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found