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.

The specified argument is outside the range of valid values

See original GitHub issue

I very rarely get the following error. It appears to self-resolve making me suspect it is intermittent based on something outside of the document being written. But I am really not sure, any suggestions apprechiated.

{“level”:0,“method”:“System.ThrowHelper.ThrowArgumentOutOfRangeException”,“assembly”:“System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e”,“line”:0}

SpanJson.JsonWriter`1.WriteUtf8ReadonlySpan",“assembly”:“SpanJson, Version=3.1.0.0, Culture=neutral, PublicKeyToken=12740fa6726bc6d3”,“line”:0}

{“level”:2,“method”:“SpanJson.JsonWriter`1.WriteUtf8String”,“assembly”:“SpanJson, Version=3.1.0.0, Culture=neutral, PublicKeyToken=12740fa6726bc6d3”,“line”:0}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
iainxtcommented, Apr 14, 2022

Yep, the bug is in that code, here is a test. It fails on i = 123.

    [Fact]
    public void EscapeGrowBug()
    {
        for (var i = 0; i < 1000; i++)
        {
            var obj = new JsonObjectSmall { N = new string('"', i) };
            var result = JsonSerializer.Generic.Utf8.Serialize(obj);
        }
    }
0reactions
iainxtcommented, Oct 11, 2022

Thanks I’ll take a look

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Stefan @.> Sent: Friday, April 15, 2022 4:58:28 PM To: Tornhoof/SpanJson @.> Cc: iainxt @.>; Author @.> Subject: Re: [Tornhoof/SpanJson] The specified argument is outside the range of valid values (Issue #163)

3.2.2 includes the changed grow size https://www.nuget.org/packages/SpanJson/3.2.2

— Reply to this email directly, view it on GitHubhttps://github.com/Tornhoof/SpanJson/issues/163#issuecomment-1099903434, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AABD4IGU4LOCFED3KZM6E5LVFEHRJANCNFSM5TNPFM7Q. You are receiving this because you authored the thread.Message ID: @.***>

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - "Specified argument was out of the range of valid values"
Obviously, you are using an index that is out of range. · The error you're getting should specify a line number. · line...
Read more >
Specified argument was out of the range of valid values. ...
You are trying to access an array or List and specifying an index value that is either negative or larger than the largest...
Read more >
'Specified argument was out of the range of valid values. ...
I got this error: on the ComboBox before and at that time, it was a VirtualizingStackPanel there in the ScrollViewer.
Read more >
Specified argument was out of the range of valid values. ...
The position of an appointment is saved and uses Microsoft's Unit struct, which has a limited range - The Unit class can represent...
Read more >
Specified argument was out of the range of valid values. ...
When I upgraded the projects target framework to net5.0 I got a runtime exception that stated "Specified argument was out of the range...
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