Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

Changed Assert.Throws* methods to pass the actual thrown exception as InnerException of AssertFailedException instead of including it in the error message string.

Changes:

  • Added ThrowAssertFailed(string, string?, Exception?) overload to accept inner exception
  • Reverted WrongExceptionThrown message format to remove {3} placeholder for exception details
  • Updated IsThrowsFailing and IsThrowsAsyncFailingAsync to pass exception to new overload
  • Updated test assertions to verify InnerException property instead of message content

Before:

// Exception details embedded in message string
throw new AssertFailedException(
    "Assert.Throws failed. Expected type:<ArgumentException>. Actual type:<Exception>. Actual exception: System.Exception: ...");

After:

// Exception available as InnerException
throw new AssertFailedException(
    "Assert.Throws failed. Expected type:<ArgumentException>. Actual type:<Exception>.",
    actualException);

Exception details remain accessible via AssertFailedException.InnerException while keeping the assertion message concise.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 15, 2025 10:29
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 15, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 80zvsblobprodcus35.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build src/TestFramework/TestFramework/TestFramework.csproj --configuration Release --nologo (dns block)
  • sc4vsblobprodcus331.vsblob.vsassets.io
    • Triggering command: /usr/bin/dotnet dotnet build src/TestFramework/TestFramework/TestFramework.csproj --configuration Release --nologo (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Report the actual exception from assertion Pass actual exception as inner exception in ThrowsException assertions Dec 15, 2025
Copilot AI requested a review from Evangelink December 15, 2025 10:33
@Evangelink Evangelink closed this Dec 15, 2025
@Evangelink Evangelink deleted the copilot/sub-pr-6989 branch December 15, 2025 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants