Skip to content

RISCV64 stacktrace test fails with NativeAOT due to missing context #129792

Description

@am11

After running all libraries and runtime tests in AOT mode on linux-riscv64 machine, I have found one issue:

This assertion fails:

Assert.Contains(nameof(InterestingMethodInTheStackTrace), exceptionText);

I added a debug (Console.Write) line and found this:

am11@k1:~/naottstlibs/http$ lldb -- ./System.Net.Http.Functional.Tests -method System.Net.Http.Functional.Tests.HttpClientSendTest_Async.Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured
SOS_HOSTING: Failed to find runtime directory
Unrecognized command 'setsymbolserver' because managed hosting failed or was disabled. See sethostruntime command for details.
(lldb) target create "./System.Net.Http.Functional.Tests"
Current executable set to '/home/am11/naottstlibs/http/System.Net.Http.Functional.Tests' (riscv64).
(lldb) settings set -- target.run-args  "-method" "System.Net.Http.Functional.Tests.HttpClientSendTest_Async.Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured"
(lldb) r
Process 3844930 launched: '/home/am11/naottstlibs/http/System.Net.Http.Functional.Tests' (riscv64)
Running assembly:System.Net.Http.Functional.Tests, Version=11.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
===== OperationCanceledException_WithOriginalCancellationToken BEGIN exceptionText =====
System.Threading.Tasks.TaskCanceledException: Useful information
 ---> System.OperationCanceledException: Useful information
 ---> System.Exception: Useful inner exception information
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 544
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpClient.HandleFailure(Exception, Boolean, HttpResponseMessage, CancellationTokenSource, CancellationToken, CancellationTokenSource) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 644
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 564
--- End of stack trace from previous location ---
   at Xunit.Assert.<RecordExceptionAsync>d__215.MoveNext() in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/Record.cs:line 139
===== OperationCanceledException_WithOriginalCancellationToken END exceptionText =====
[FAIL] System.Net.Http.Functional.Tests.HttpClientSendTest_Async.Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured(scenario: OperationCanceledException_WithOriginalCancellationToken)
Assert.Contains() Failure: Sub-string not found
String:    "System.Threading.Tasks.TaskCanceledException: Usef"···
Not found: "InterestingMethodInTheStackTrace"
   at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured(HttpClientTest.HttpClientSendTest.ExceptionScenario) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1636
--- End of stack trace from previous location ---
--- End of stack trace from previous location ---
--- End of stack trace from previous location ---
===== OperationCanceledException_UnknownCancellationToken BEGIN exceptionText =====
System.Threading.Tasks.TaskCanceledException: Useful information
 ---> System.OperationCanceledException: Useful information
 ---> System.Exception: Useful inner exception information
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 544
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpClient.HandleFailure(Exception, Boolean, HttpResponseMessage, CancellationTokenSource, CancellationToken, CancellationTokenSource) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 644
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 564
--- End of stack trace from previous location ---
   at Xunit.Assert.<RecordExceptionAsync>d__215.MoveNext() in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/Record.cs:line 139
===== OperationCanceledException_UnknownCancellationToken END exceptionText =====
[FAIL] System.Net.Http.Functional.Tests.HttpClientSendTest_Async.Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured(scenario: OperationCanceledException_UnknownCancellationToken)
Assert.Contains() Failure: Sub-string not found
String:    "System.Threading.Tasks.TaskCanceledException: Usef"···
Not found: "InterestingMethodInTheStackTrace"
   at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured(HttpClientTest.HttpClientSendTest.ExceptionScenario) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1636
--- End of stack trace from previous location ---
--- End of stack trace from previous location ---
--- End of stack trace from previous location ---
===== HttpRequestException BEGIN exceptionText =====
System.Net.Http.HttpRequestException: Useful information
 ---> System.Exception: Useful inner exception information
   --- End of inner exception stack trace ---
   at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>g__InterestingMethodInTheStackTrace|6_1(Func`1 exceptionFactory) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1639
   at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<>c__DisplayClass6_0.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>b__0(HttpRequestMessage, CancellationToken) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1607
   at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<>c__DisplayClass6_0.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>b__0(HttpRequestMessage _, CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 544
--- End of stack trace from previous location ---
   at Xunit.Assert.<RecordExceptionAsync>d__215.MoveNext() in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/Record.cs:line 139
===== HttpRequestException END exceptionText =====
===== HttpRequestException_DuringCancellation BEGIN exceptionText =====
System.Threading.Tasks.TaskCanceledException: The operation was canceled.
 ---> System.Net.Http.HttpRequestException: Useful information
 ---> System.Exception: Useful inner exception information
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 544
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpClient.HandleFailure(Exception, Boolean, HttpResponseMessage, CancellationTokenSource, CancellationToken, CancellationTokenSource) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 644
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 564
--- End of stack trace from previous location ---
   at Xunit.Assert.<RecordExceptionAsync>d__215.MoveNext() in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/Record.cs:line 139
===== HttpRequestException_DuringCancellation END exceptionText =====
[FAIL] System.Net.Http.Functional.Tests.HttpClientSendTest_Async.Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured(scenario: HttpRequestException_DuringCancellation)
Assert.Contains() Failure: Sub-string not found
String:    "System.Threading.Tasks.TaskCanceledException: The "···
Not found: "InterestingMethodInTheStackTrace"
   at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured(HttpClientTest.HttpClientSendTest.ExceptionScenario) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1636
--- End of stack trace from previous location ---
--- End of stack trace from previous location ---
--- End of stack trace from previous location ---
===== UnknownException BEGIN exceptionText =====
System.Exception: Useful information
 ---> System.Exception: Useful inner exception information
   --- End of inner exception stack trace ---
   at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>g__InterestingMethodInTheStackTrace|6_1(Func`1 exceptionFactory) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1639
   at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<>c__DisplayClass6_0.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>b__0(HttpRequestMessage, CancellationToken) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1613
   at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<>c__DisplayClass6_0.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>b__0(HttpRequestMessage _, CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 544
--- End of stack trace from previous location ---
   at Xunit.Assert.<RecordExceptionAsync>d__215.MoveNext() in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/Record.cs:line 139
===== UnknownException END exceptionText =====
===== UnknownException_DuringCancellation BEGIN exceptionText =====
System.Exception: Useful information
 ---> System.Exception: Useful inner exception information
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 544
--- End of stack trace from previous location ---
   at Xunit.Assert.<RecordExceptionAsync>d__215.MoveNext() in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/Record.cs:line 139
===== UnknownException_DuringCancellation END exceptionText =====
[FAIL] System.Net.Http.Functional.Tests.HttpClientSendTest_Async.Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured(scenario: UnknownException_DuringCancellation)
Assert.Contains() Failure: Sub-string not found
String:    "System.Exception: Useful information\n ---> System."···
Not found: "InterestingMethodInTheStackTrace"
   at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured(HttpClientTest.HttpClientSendTest.ExceptionScenario) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1636
--- End of stack trace from previous location ---
--- End of stack trace from previous location ---
--- End of stack trace from previous location ---
Finished System.Net.Http.Functional.Tests, Version=11.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51

Tests run: 6, Errors: 0, Failures: 4, Skipped: 0. Time: 0.1947178s
Process 3844930 exited with status = 1 (0x00000001) 
(lldb) q

Activity

  1. dotnet-policy-service commented on Jun 24, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib
    See info in area-owners.md if you want to be subscribed.

  2. am11 commented on Jun 24, 2026

    @am11
    MemberAuthor

    cc @dotnet/samsung, @filipnavara,

    Build steps:

    # on osx-arm64
    $ cd runtime
    $ docker run --rm -v$(pwd):/runtime -w /runtime -e ROOTFS_DIR=/crossrootfs/riscv64 -it ubuntu
    $ eng/common/native/install-dependencies.sh
    $ apt install -y python3-venv
    $ rootfsEnv="/usr/local/share/rootfs" && python3 -m venv "$rootfsEnv" && "$rootfsEnv/bin/python" -m pip install aiohttp zstandard && PYTHON_EXECUTABLE="$rootfsEnv/bin/python" ./eng/common/cross/build-rootfs.sh riscv64 noble --skipunmount --skipemulation
    $ os=linux; arch=riscv64
    
    $ ./build.sh clr+libs --cross --arch $arch --os $os -c Release --bootstrap
    $ ./build.sh libs.tests --cross --arch $arch --os $os --use-bootstrap -c Release -p:TestNativeAot=true -p:ArchiveTests=true

    Then scp test archive to riscv64 computer (k1) and run tests:

    # from os-x64
    $ scp artifacts/helix/tests/linux.AnyCPU.Release/System.Net.Http.Functional.Tests.zip k1:/tmp
    $ ssh k1
    $ mkdir -p ~/naottstlibs/http && cd $_
    $ unzip /tmp/System.Net.Http.Functional.Tests.zip &>/dev/null
    
    # run full HTTP test suite
    $ ./RunTests.sh --runtime-path foo # foo is needed just to satisfy this script; it doesn't use corerun in AOT mode...
    
    # run this specific test
    $ ./System.Net.Http.Functional.Tests -method System.Net.Http.Functional.Tests.HttpClientSendTest_Async.Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured
  3. am11 commented on Jun 24, 2026

    @am11
    MemberAuthor

    It probably doesn't capture context around async resumption (runtime async?); the sync variant of this test passes.

  4. am11 commented on Jun 24, 2026

    @am11
    MemberAuthor

    On linux-arm64, it passes:

    $ root@426b2454e6c3:/httptst# ./System.Net.Http.Functional.Tests -method System.Net.Http.Functional.Tests.HttpClientSendTest_Async.Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured
    Running assembly:System.Net.Http.Functional.Tests, Version=11.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
    ===== OperationCanceledException_WithOriginalCancellationToken BEGIN exceptionText =====
    System.Threading.Tasks.TaskCanceledException: Useful information
     ---> System.OperationCanceledException: Useful information
     ---> System.Exception: Useful inner exception information
       --- End of inner exception stack trace ---
       at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>g__InterestingMethodInTheStackTrace|6_1(Func`1 exceptionFactory) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1639
       at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<>c__DisplayClass6_0.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>b__0(HttpRequestMessage, CancellationToken) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1596
    --- End of stack trace from previous location ---
       at System.Runtime.CompilerServices.RuntimeAsyncTaskContinuation.GetResult[T](Task, Byte&) in /runtime/src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeAsyncTaskContinuation.cs:line 140
       at System.Runtime.CompilerServices.RuntimeAsyncTaskContinuation.TaskContinuationResume.ResumeTaskContinuation(Continuation, Byte&) in /runtime/src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeAsyncTaskContinuation.cs:line 163
       at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 544
       --- End of inner exception stack trace ---
       at System.Net.Http.HttpClient.HandleFailure(Exception, Boolean, HttpResponseMessage, CancellationTokenSource, CancellationToken, CancellationTokenSource) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 644
       at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 564
    --- End of stack trace from previous location ---
       at Xunit.Assert.<RecordExceptionAsync>d__215.MoveNext() in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/Record.cs:line 139
    ===== OperationCanceledException_WithOriginalCancellationToken END exceptionText =====
    ===== OperationCanceledException_UnknownCancellationToken BEGIN exceptionText =====
    System.Threading.Tasks.TaskCanceledException: Useful information
     ---> System.OperationCanceledException: Useful information
     ---> System.Exception: Useful inner exception information
       --- End of inner exception stack trace ---
       at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>g__InterestingMethodInTheStackTrace|6_1(Func`1 exceptionFactory) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1639
       at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<>c__DisplayClass6_0.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>b__0(HttpRequestMessage, CancellationToken) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1601
    --- End of stack trace from previous location ---
       at System.Runtime.CompilerServices.RuntimeAsyncTaskContinuation.GetResult[T](Task, Byte&) in /runtime/src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeAsyncTaskContinuation.cs:line 140
       at System.Runtime.CompilerServices.RuntimeAsyncTaskContinuation.TaskContinuationResume.ResumeTaskContinuation(Continuation, Byte&) in /runtime/src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeAsyncTaskContinuation.cs:line 163
       at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 544
       --- End of inner exception stack trace ---
       at System.Net.Http.HttpClient.HandleFailure(Exception, Boolean, HttpResponseMessage, CancellationTokenSource, CancellationToken, CancellationTokenSource) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 644
       at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 564
    --- End of stack trace from previous location ---
       at Xunit.Assert.<RecordExceptionAsync>d__215.MoveNext() in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/Record.cs:line 139
    ===== OperationCanceledException_UnknownCancellationToken END exceptionText =====
    ===== HttpRequestException BEGIN exceptionText =====
    System.Net.Http.HttpRequestException: Useful information
     ---> System.Exception: Useful inner exception information
       --- End of inner exception stack trace ---
       at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>g__InterestingMethodInTheStackTrace|6_1(Func`1 exceptionFactory) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1639
       at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<>c__DisplayClass6_0.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>b__0(HttpRequestMessage, CancellationToken) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1607
       at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<>c__DisplayClass6_0.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>b__0(HttpRequestMessage _, CancellationToken cancellationToken)
    --- End of stack trace from previous location ---
       at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 544
    --- End of stack trace from previous location ---
       at Xunit.Assert.<RecordExceptionAsync>d__215.MoveNext() in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/Record.cs:line 139
    ===== HttpRequestException END exceptionText =====
    ===== HttpRequestException_DuringCancellation BEGIN exceptionText =====
    System.Threading.Tasks.TaskCanceledException: The operation was canceled.
     ---> System.Net.Http.HttpRequestException: Useful information
     ---> System.Exception: Useful inner exception information
       --- End of inner exception stack trace ---
       at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>g__InterestingMethodInTheStackTrace|6_1(Func`1 exceptionFactory) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1639
       at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<>c__DisplayClass6_0.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>b__0(HttpRequestMessage, CancellationToken) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1607
    --- End of stack trace from previous location ---
       at System.Runtime.CompilerServices.RuntimeAsyncTaskContinuation.GetResult[T](Task, Byte&) in /runtime/src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeAsyncTaskContinuation.cs:line 140
       at System.Runtime.CompilerServices.RuntimeAsyncTaskContinuation.TaskContinuationResume.ResumeTaskContinuation(Continuation, Byte&) in /runtime/src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeAsyncTaskContinuation.cs:line 163
       at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 544
       --- End of inner exception stack trace ---
       at System.Net.Http.HttpClient.HandleFailure(Exception, Boolean, HttpResponseMessage, CancellationTokenSource, CancellationToken, CancellationTokenSource) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 644
       at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 564
    --- End of stack trace from previous location ---
       at Xunit.Assert.<RecordExceptionAsync>d__215.MoveNext() in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/Record.cs:line 139
    ===== HttpRequestException_DuringCancellation END exceptionText =====
    ===== UnknownException BEGIN exceptionText =====
    System.Exception: Useful information
     ---> System.Exception: Useful inner exception information
       --- End of inner exception stack trace ---
       at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>g__InterestingMethodInTheStackTrace|6_1(Func`1 exceptionFactory) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1639
       at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<>c__DisplayClass6_0.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>b__0(HttpRequestMessage, CancellationToken) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1613
       at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<>c__DisplayClass6_0.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>b__0(HttpRequestMessage _, CancellationToken cancellationToken)
    --- End of stack trace from previous location ---
       at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 544
    --- End of stack trace from previous location ---
       at Xunit.Assert.<RecordExceptionAsync>d__215.MoveNext() in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/Record.cs:line 139
    ===== UnknownException END exceptionText =====
    ===== UnknownException_DuringCancellation BEGIN exceptionText =====
    System.Exception: Useful information
     ---> System.Exception: Useful inner exception information
       --- End of inner exception stack trace ---
       at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>g__InterestingMethodInTheStackTrace|6_1(Func`1 exceptionFactory) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1639
       at System.Net.Http.Functional.Tests.HttpClientTest.HttpClientSendTest.<>c__DisplayClass6_0.<Send_InnerHandlerThrows_OriginalExceptionInformationIsCaptured>b__0(HttpRequestMessage, CancellationToken) in /runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs:line 1613
    --- End of stack trace from previous location ---
       at System.Runtime.CompilerServices.RuntimeAsyncTaskContinuation.GetResult[T](Task, Byte&) in /runtime/src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeAsyncTaskContinuation.cs:line 140
       at System.Runtime.CompilerServices.RuntimeAsyncTaskContinuation.TaskContinuationResume.ResumeTaskContinuation(Continuation, Byte&) in /runtime/src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeAsyncTaskContinuation.cs:line 163
       at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage, HttpCompletionOption, CancellationTokenSource, Boolean, CancellationTokenSource, CancellationToken) in /runtime/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs:line 544
    --- End of stack trace from previous location ---
       at Xunit.Assert.<RecordExceptionAsync>d__215.MoveNext() in /_/src/arcade/src/Microsoft.DotNet.XUnitAssert/src/Record.cs:line 139
    ===== UnknownException_DuringCancellation END exceptionText =====
    Finished System.Net.Http.Functional.Tests, Version=11.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
    
    Tests run: 6, Errors: 0, Failures: 0, Skipped: 0. Time: 0.2227099s

    note I had that debug line in this build as well:

    --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs
    +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs
    @@ -1629,6 +1629,8 @@ or ExceptionScenario.HttpRequestException_DuringCancellation
     
                     string exceptionText = ex.ToString();
     
    +                Console.WriteLine($"===== {scenario} BEGIN exceptionText =====\n{exceptionText}\n===== {scenario} END exceptionText =====");
    +
                     Assert.Contains(InterestingExceptionMessage, exceptionText);
                     Assert.Contains(InterestingInnerExceptionMessage, exceptionText);
                     Assert.Contains(nameof(InterestingMethodInTheStackTrace), exceptionText);
  5. added this to the Future milestone on Jun 25, 2026
  6. locked and limited conversation to collaborators on Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions