Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[6.0] Test failure in System.Text.Json.Tests.Utf8JsonWriterTests.Writing3MBBase64Bytes(formatted: True, skipValidation: False) #96879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
carlossanlop opened this issue Jan 12, 2024 · 3 comments
Labels
arch-x64 area-System.Text.Json Known Build Error Use this to report build issues in the .NET Helix tab os-mac-os-x macOS aka OSX runtime-mono specific to the Mono runtime test-bug Problem in test source code (most likely)
Milestone

Comments

@carlossanlop
Copy link
Member

carlossanlop commented Jan 12, 2024

Error Blob

{
  "ErrorMessage": "KioqKioqKioq",
  "BuildRetry": false,
  "ErrorPattern": "",
  "ExcludeConsoleLog": true
}

Reproduction Steps

===========================================================================================================
/private/tmp/helix/working/B6440A0C/w/B37609D6/e /private/tmp/helix/working/B6440A0C/w/B37609D6/e
  Discovering: System.Text.Json.Tests (method display = ClassAndMethod, method display options = None)
  Discovered:  System.Text.Json.Tests (found 2807 of 2855 test cases)
  Starting:    System.Text.Json.Tests (parallel test collections = on, max threads = 12)
    System.Text.Json.Tests.Utf8JsonWriterTests.Writing3MBBase64Bytes(formatted: True, skipValidation: False) [FAIL]
      Assert.Equal() Failure
                                       ↓ (pos 1371297)
      Expected: ···KioqKioqKioqKioqKioqkioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK···
      Actual:   ···KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK···
                                       ↑ (pos 1371297)
      Stack Trace:
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonTestHelper.cs(738,0): at System.Text.Json.JsonTestHelper.AssertContentsAgainstJsonNet(String expectedValue, String value, Boolean skipSpecialRules)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonTestHelper.cs(714,0): at System.Text.Json.JsonTestHelper.AssertContents(String expectedValue, ArrayBufferWriter`1 buffer, Boolean skipSpecialRules)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonWriterTests.cs(3175,0): at System.Text.Json.Tests.Utf8JsonWriterTests.Writing3MBBase64Bytes(Boolean formatted, Boolean skipValidation)
        /_/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs(370,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
  Finished:    System.Text.Json.Tests
=== TEST EXECUTION SUMMARY ===
   System.Text.Json.Tests  Total: 19695, Errors: 0, Failed: 1, Skipped: 0, Time: 83.984s
/private/tmp/helix/working/B6440A0C/w/B37609D6/e
----- end Wed Jan 10 19:26:02 EST 2024 ----- exit code 1 ----------------------------------------------------------

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=522551
Error message validated: KioqKioqKioq
Result validation: ❌ Known issue did not match with the provided build.
Validation performed at: 1/12/2024 3:46:27 AM UTC

Report

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 0
@carlossanlop carlossanlop added area-System.Text.Json os-mac-os-x macOS aka OSX arch-x64 blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' runtime-mono specific to the Mono runtime Known Build Error Use this to report build issues in the .NET Helix tab labels Jan 12, 2024
@ghost
Copy link

ghost commented Jan 12, 2024

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

Error Blob

{
  "ErrorMessage": "KioqKioqKioq",
  "BuildRetry": false,
  "ErrorPattern": "",
  "ExcludeConsoleLog": true
}

Reproduction Steps

===========================================================================================================
/private/tmp/helix/working/B6440A0C/w/B37609D6/e /private/tmp/helix/working/B6440A0C/w/B37609D6/e
  Discovering: System.Text.Json.Tests (method display = ClassAndMethod, method display options = None)
  Discovered:  System.Text.Json.Tests (found 2807 of 2855 test cases)
  Starting:    System.Text.Json.Tests (parallel test collections = on, max threads = 12)
    System.Text.Json.Tests.Utf8JsonWriterTests.Writing3MBBase64Bytes(formatted: True, skipValidation: False) [FAIL]
      Assert.Equal() Failure
                                       ↓ (pos 1371297)
      Expected: ···KioqKioqKioqKioqKioqkioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK···
      Actual:   ···KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK···
                                       ↑ (pos 1371297)
      Stack Trace:
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonTestHelper.cs(738,0): at System.Text.Json.JsonTestHelper.AssertContentsAgainstJsonNet(String expectedValue, String value, Boolean skipSpecialRules)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonTestHelper.cs(714,0): at System.Text.Json.JsonTestHelper.AssertContents(String expectedValue, ArrayBufferWriter`1 buffer, Boolean skipSpecialRules)
        /_/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonWriterTests.cs(3175,0): at System.Text.Json.Tests.Utf8JsonWriterTests.Writing3MBBase64Bytes(Boolean formatted, Boolean skipValidation)
        /_/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs(370,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
  Finished:    System.Text.Json.Tests
=== TEST EXECUTION SUMMARY ===
   System.Text.Json.Tests  Total: 19695, Errors: 0, Failed: 1, Skipped: 0, Time: 83.984s
/private/tmp/helix/working/B6440A0C/w/B37609D6/e
----- end Wed Jan 10 19:26:02 EST 2024 ----- exit code 1 ----------------------------------------------------------
Author: carlossanlop
Assignees: -
Labels:

area-System.Text.Json, os-mac-os-x, arch-x64, blocking-clean-ci, runtime-mono, Known Build Error

Milestone: -

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jan 12, 2024
@eiriktsarpalis
Copy link
Member

eiriktsarpalis commented Jan 12, 2024

Here's the test in question:

public void Writing3MBBase64Bytes(JsonWriterOptions options)
{
byte[] value = new byte[3 * 1024 * 1024];
value.AsSpan().Fill(168);
byte[] base64StringUtf8 = new byte[Base64.GetMaxEncodedToUtf8Length(value.Length)];
Base64.EncodeToUtf8(value, base64StringUtf8, out _, out int bytesWritten);
string expectedValue = Encoding.UTF8.GetString(base64StringUtf8.AsSpan(0, bytesWritten).ToArray());
string expectedJson = options.Indented ? $"{{{Environment.NewLine}{GetIndentText(options)}\"foo\": \"{expectedValue}\"{Environment.NewLine}}}" : $"{{\"foo\":\"{expectedValue}\"}}";
var output = new ArrayBufferWriter<byte>(1024);
using (var jsonUtf8 = new Utf8JsonWriter(output, options))
{
jsonUtf8.WriteBase64StringValue(value);
}
JsonTestHelper.AssertContents($"\"{expectedValue}\"", output);
output.Clear();
using (var jsonUtf8 = new Utf8JsonWriter(output, options))
{
jsonUtf8.WriteStartObject();
jsonUtf8.WriteBase64String("foo", value);
jsonUtf8.WriteEndObject();
}
JsonTestHelper.AssertContents(expectedJson, output);
output.Clear();
using (var jsonUtf8 = new Utf8JsonWriter(output, options))
{
jsonUtf8.WriteStartObject();
jsonUtf8.WriteBase64String("foo"u8, value);
jsonUtf8.WriteEndObject();
}
JsonTestHelper.AssertContents(expectedJson, output);
output.Clear();
using (var jsonUtf8 = new Utf8JsonWriter(output, options))
{
jsonUtf8.WriteStartObject();
jsonUtf8.WriteBase64String("foo".AsSpan(), value);
jsonUtf8.WriteEndObject();
}
JsonTestHelper.AssertContents(expectedJson, output);
output.Clear();
using (var jsonUtf8 = new Utf8JsonWriter(output, options))
{
jsonUtf8.WriteStartObject();
jsonUtf8.WriteBase64String(JsonEncodedText.Encode("foo"), value);
jsonUtf8.WriteEndObject();
}
JsonTestHelper.AssertContents(expectedJson, output);
}

The odd thing is that it appears that it's the expected string that's been corrupted, whereas the actual value is correct. The test itself is pretty old, and I'm not sure I entirely follow its logic -- it appears to be doing some sort of convoluted normalization logic to test an otherwise straightforward property of writing Base64 strings.

@eiriktsarpalis eiriktsarpalis added test-bug Problem in test source code (most likely) and removed untriaged New issue has not been triaged by the area owner labels Jan 12, 2024
@eiriktsarpalis eiriktsarpalis added this to the Future milestone Jan 12, 2024
@jeffschwMSFT jeffschwMSFT removed the blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' label Feb 15, 2024
@jeffschwMSFT
Copy link
Member

was not seen recently... dropping blocking-clean-ci

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 0 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-x64 area-System.Text.Json Known Build Error Use this to report build issues in the .NET Helix tab os-mac-os-x macOS aka OSX runtime-mono specific to the Mono runtime test-bug Problem in test source code (most likely)
Projects
None yet
Development

No branches or pull requests

3 participants