Skip to content

[ci-scan] Known Build Error: StreamReader NegativeOneBufferSize test fails under PGO #128062

Closed

Description

@github-actions

Build Information

Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1414905
Pipeline: runtime-coreclr libraries-pgo (definition 145)
Affected leg: linux-x64 Release

Error Message

{
  "ErrorMessage": ["bufferSize ('-1') must be a non-negative and non-zero value"],
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Summary

System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException fails under PGO (libraries-pgo pipeline). The test expects that new StreamReader(path, Encoding.UTF8, true, -1) does not throw, but under PGO it throws ArgumentOutOfRangeException: bufferSize ('-1') must be a non-negative and non-zero value.

The StreamReader(string, Encoding, bool, int) constructor calls ValidateArgsAndOpenPath(path, bufferSize) which skips validation for -1, then chains to the Stream-based constructor which converts -1 to DefaultBufferSize. Under normal execution this works; the PGO-compiled code path may be reordering or inlining in a way that hits validation before the -1 → default conversion.

Impact on platforms

  • runtime-coreclr libraries-pgo (def 145) · linux-x64 Release · exit code 1

Console log

System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException [FAIL]
      System.ArgumentOutOfRangeException : bufferSize ('-1') must be a non-negative and non-zero value. (Parameter 'bufferSize')
      Stack Trace:
        at System.ArgumentOutOfRangeException.ThrowNegativeOrZero[T](T value, String paramName)
        at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
        at System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException()

Console log

First build it occurred

Present in builds 1414905 (May 10) and 1414533 (May 9). ≥2 occurrences.

Recommended action

Investigate whether PGO-guided inlining/optimization is changing the evaluation order of ValidateArgsAndOpenPath and the Stream ctor's bufferSize check. The -1 sentinel value should be converted to DefaultBufferSize before ThrowIfNegativeOrZero runs.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • dotnet.github.io

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "dotnet.github.io"

See Network Configuration for more information.

Note

🔒 Integrity filter blocked 4 items

The following items were blocked because they don't meet the GitHub integrity level.

  • #116358 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #86273 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #125436 search_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #128019 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

Generated by CI Outer-Loop Failure Scanner · ● 56.5M · ◷

Report

Build Definition Test Pull Request
1416672 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #126671

Summary

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

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1414905
Error message validated: [NegativeOneBufferSize_ShouldNotThrowException System.ArgumentOutOfRangeException]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 5/12/2026 11:31:36 AM UTC

Report

Build Definition Test Pull Request
1416672 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #126671
1414905 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException

Summary

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

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1414905
Error message validated: [NegativeOneBufferSize_ShouldNotThrowException System.ArgumentOutOfRangeException]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 5/12/2026 11:31:36 AM UTC

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1414905
Error message validated: [bufferSize ('-1') must be a non-negative and non-zero value]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 5/13/2026 8:12:07 AM UTC

Report

Build Repository Test Pull Request
1484392 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException
1484363 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #129923
1483955 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #129918
1483794 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #129769
1480581 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #129761
1480364 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #129826
1478400 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #129543
1475733 dotnet/runtime System.IO.Tests.StreamWriter_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #128702
1470142 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #129561
1466621 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #129466
1465227 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #129398
1463187 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #129379
1457883 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #126845
1455131 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #129080
1452853 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #129084
1440246 dotnet/runtime System.IO.Tests.StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException #128740

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
4 8 16

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1414905
Error message validated: [NegativeOneBufferSize_ShouldNotThrowException System.ArgumentOutOfRangeException]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 5/12/2026 11:31:36 AM UTC

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1414905
Error message validated: [bufferSize ('-1') must be a non-negative and non-zero value]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 5/13/2026 8:12:07 AM UTC

Activity

  1. added
    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
    on May 12, 2026
  2. dotnet-policy-service commented on May 12, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
    See info in area-owners.md if you want to be subscribed.

  3. added and removed
    untriagedNew issue has not been triaged by the area owner
    blocking-clean-ciBlocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'
    on May 13, 2026
  4. added this to the 11.0.0 milestone on May 13, 2026
  5. github-actions commented on Jun 18, 2026

    @github-actions
    ContributorAuthor

    Workflow artifact: ci-fix
    Artifact kind: handoff
    Linked KBE: #128062

    Note

    AI/Copilot-generated triage note.

    This Known Build Error has no producible automated code change (reason: JIT/PGO miscompilation — the product code is correct and the fix requires changes to JIT optimization passes, which exceeds automated bounds), so I could not open even a best-effort PR. Looping in owners so it can be fixed forward rather than muted.

    Root cause (best analysis)

    StreamReader_StringCtorTests.NegativeOneBufferSize_ShouldNotThrowException fails under PGO (runtime-coreclr libraries-pgo) because PGO-guided inlining miscompiles the -1 sentinel handling in StreamReader.

    The product code in System.Private.CoreLib/src/System/IO/StreamReader.cs is correct:

    1. StreamReader(string path, Encoding, bool, int bufferSize) (line 199) chains to:
      • ValidateArgsAndOpenPath(path, bufferSize) — which skips ThrowIfNegativeOrZero when bufferSize == -1 (line 230)
      • Then the stream-based constructor (line 138)
    2. The stream constructor (line 150-154) converts -1 to DefaultBufferSize before calling ThrowIfNegativeOrZero

    Under PGO, when both ValidateArgsAndOpenPath and the stream constructor are inlined into the string-path constructor, the JIT appears to miscompile the conditional branch that converts -1 to DefaultBufferSize. The stack trace confirms inlining:

    at System.ArgumentOutOfRangeException.ThrowNegativeOrZero[T](T value, String paramName)
    at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
    

    The intermediate StreamReader(Stream, ...) frame is absent, confirming it was inlined. The ThrowNegativeOrZero(-1) call fires despite the guarding if (bufferSize == -1) check.

    Evidence

    Suggested reviewers / area contacts

    • Assignee: @EgorBo (already assigned, milestone 11.0.0)
    • Area owners (area-CodeGen-coreclr): @JulieLeeMSFT, @jakobbotsch

    The fix likely involves the JIT's handling of conditional branches around ThrowIfNegativeOrZero when inlining across constructor chains under PGO.

    Note

    🔒 Integrity filter blocked 1 item

    The following item was blocked because it doesn't meet the GitHub integrity level.

    To allow these resources, lower min-integrity in your GitHub frontmatter:

    tools:
      github:
        min-integrity: approved  # merged | approved | unapproved | none

    Generated by CI Outer-Loop Failure Fixer · ● 51.4M · ◷

  6. added a commit that references this issue on Jun 27, 2026
    8b45e69
  7. added a commit that references this issue on Jul 15, 2026
    a1672ef
  8. locked and limited conversation to collaborators on Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Known Build ErrorUse this to report build issues in the .NET Helix tabagentic-workflowsarea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIblocking-clean-ci-optionalBlocking optional rolling runs

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions