Skip to content

[ci-scan] Test failure: HostTests on iossimulator - Castle.DynamicProxy IndexOutOfRangeException #128405

Closed

Description

@github-actions

Build Information

Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1427615
Build error leg or test failing: iossimulator-arm64 Release AllSubsets_CoreCLR - Microsoft.Extensions.Hosting.Unit.Tests

Error Details

Multiple HostTests tests fail on iossimulator-arm64 with System.IndexOutOfRangeException in Castle.DynamicProxy.Generators.MethodWithInvocationGenerator.BuildProxiedMethodBody. This is a Moq/Castle.DynamicProxy code-generation issue specific to the iOS simulator CoreCLR environment.

Failing tests:

  • Microsoft.Extensions.Hosting.Internal.HostTests.Dispose_DisposesHostConfigurationProviders
  • Microsoft.Extensions.Hosting.Internal.HostTests.HostStopAsyncCanBeCancelledEarly
  • Microsoft.Extensions.Hosting.Internal.HostTests.DisposeAsync_DisposesAppConfigurationProviders
  • Microsoft.Extensions.Hosting.Internal.HostTests.DisposeAsync_DisposesHostConfigurationProviders
  • Microsoft.Extensions.Hosting.Internal.HostTests.HostStopAsyncUsesDefaultTimeoutIfGivenTokenDoesNotFire
  • Microsoft.Extensions.Hosting.Internal.HostTests.Dispose_DisposesAppConfigurationProviders
  • Microsoft.Extensions.Hosting.Internal.HostTests.WebHostStopAsyncUsesDefaultTimeoutIfNoTokenProvided
[FAIL] Microsoft.Extensions.Hosting.Internal.HostTests.Dispose_DisposesHostConfigurationProviders
System.IndexOutOfRangeException : Index was outside the bounds of the array.
   at Castle.DynamicProxy.Generators.MethodWithInvocationGenerator.BuildProxiedMethodBody(MethodEmitter emitter, ClassEmitter class, INamingScope namingScope)
   at Castle.DynamicProxy.Generators.MethodGenerator.Generate(ClassEmitter class, INamingScope namingScope)

Affected legs:

  • runtime-extra-platforms (def 154): iossimulator-arm64 Release AllSubsets_CoreCLR

First build it occurred: 1425947 (2026-05-19). 2 occurrences in scanned window (builds 1425947 and 1427615).

Error Message

{
  "ErrorMessage": ["HostTests", "System.IndexOutOfRangeException : Index was outside the bounds of the array."],
  "ErrorPattern": "",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Note

🔒 Integrity filter blocked 1 item

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

  • #125825 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 · ● 22.5M · ◷

Report

Summary

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

Activity

  1. dotnet-policy-service commented on May 20, 2026

    @dotnet-policy-service
    Contributor

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

  2. github-actions commented on Jun 14, 2026

    @github-actions
    ContributorAuthor

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

    Note

    AI/Copilot-generated triage note.

    This Known Build Error has no producible automated code change (reason: JIT/GC codegen — must not be auto-fixed), 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)

    HostTests.Dispose_DisposesHostConfigurationProviders (and several sibling HostTests) fail on iossimulator-arm64 AllSubsets_CoreCLR with System.IndexOutOfRangeException originating in Castle.DynamicProxy.Generators.MethodWithInvocationGenerator.BuildProxiedMethodBody.

    The failing log line:

    [FAIL] Microsoft.Extensions.Hosting.Internal.HostTests.Dispose_DisposesHostConfigurationProviders
    System.IndexOutOfRangeException : Index was outside the bounds of the array.
       at Castle.DynamicProxy.Generators.MethodWithInvocationGenerator.BuildProxiedMethodBody(MethodEmitter emitter, ClassEmitter class, INamingScope namingScope)
    

    Source location: The crash is in Castle.DynamicProxy (Moq dependency), not in dotnet/runtime product code. Castle.DynamicProxy emits IL at runtime to create mock proxies. The IndexOutOfRangeException in BuildProxiedMethodBody indicates that the CoreCLR interpreter on iOS simulator does not handle some aspect of Castle.DynamicProxy's IL generation correctly — likely a metadata token resolution or method signature indexing difference under the interpreter compared to the full JIT.

    This failure is specific to the CoreCLR interpreter path on iOS simulator (area-CodeGen-Interpreter-coreclr). No fix can be produced by this automated workflow because it requires understanding and fixing the interpreter's handling of dynamically emitted IL.

    Evidence

    Suggested reviewers / area contacts

    • Area owners (area-CodeGen-Interpreter-coreclr): @JulieLeeMSFT, @BrzVlad, @janvorli
    • Area team: @dotnet/jit-contrib

    A fix would likely involve investigating how the CoreCLR interpreter handles Castle.DynamicProxy's dynamically emitted IL (specifically the method signature metadata that BuildProxiedMethodBody indexes into), or determining whether these Moq-dependent tests should not run under the interpreter configuration.

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

  3. added
    disabled-testThe test is disabled in source code against the issue
    on Jun 29, 2026
  4. added this to the 11.0.0 milestone on Jun 29, 2026
  5. removed
    blocking-clean-ciBlocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'
    on Jul 15, 2026
  6. jeffschwMSFT commented on Jul 15, 2026

    @jeffschwMSFT
    Member

    removing blocking-clean-ci as it has not failed in 30 days

    24-Hour Hit Count 7-Day Hit Count 1-Month Count
    0 0 0
  7. self-assigned this
    on Jul 22, 2026
  8. github-actions commented on Jul 28, 2026

    @github-actions
    ContributorAuthor

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

    Note

    AI/Copilot-generated triage note.

    This Known Build Error has no producible automated code change (reason: interpreter/codegen bug in the CoreCLR interpreter surfaced through Reflection.Emit — must not be auto-fixed), so I could not open a best-effort PR. Looping in owners to fix forward rather than mute. An earlier automated attempt to skip these tests (PR #128469) was closed without merge, so a mute is not the desired outcome.

    Root cause (best analysis)

    Microsoft.Extensions.Hosting HostTests (which use Moq/Castle.DynamicProxy) fail on iossimulator-arm64 Release AllSubsets_CoreCLR with:

    System.IndexOutOfRangeException : Index was outside the bounds of the array.
       at Castle.DynamicProxy.Generators.MethodWithInvocationGenerator.BuildProxiedMethodBody(...)
       at Castle.DynamicProxy.Generators.MethodGenerator.Generate(...)
    

    The failure is Castle.DynamicProxy emitting IL via Reflection.Emit and hitting an out-of-bounds index only under the iOS-simulator CoreCLR (interpreter) environment. This points at a Reflection.Emit / interpreter-mode code-generation defect on that configuration rather than a bug in the Hosting tests themselves. A safe fix requires interpreter/Reflection.Emit owner investigation, which is outside the automated small-fix bounds.

    Evidence

    Suggested reviewers / area contacts

    • Likely author: none identified with sufficient confidence
    • Area owners (area-CodeGen-Interpreter-coreclr): @BrzVlad, @janvorli

    A fix likely involves diagnosing the Reflection.Emit / interpreter code path that produces the out-of-bounds index when Castle.DynamicProxy generates proxy method bodies on iOS-simulator CoreCLR.

    Warning

    Firewall blocked 1 domain

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

    • awmgmcpg

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

    network:
      allowed:
        - defaults
        - "awmgmcpg"

    See Network Configuration for more information.

    Generated by CI Outer-Loop Failure Fixer · 226.4 AIC · ⌖ 19 AIC · ⊞ 17.1K · ◷

  9. modified the milestones: 11.0.0, 12.0.0 on Aug 10, 2026
  10. added a commit that references this issue on Aug 11, 2026
  11. locked and limited conversation to collaborators on Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions