Skip to content

Assertion failure text includes excessive source code #2248

@InteXX

Description

@InteXX

Description

I'm running a rather long and verbose test; bear with me please. I've placed its code—and the response—below for easier reading.

The problem is that when an assertion fails, the remainder of the code starting at the point of the assertion is dumped into the failure output. Given the complexity of the test, this results in a very difficult-to-interpret response.

Is this by design, a bug or merely a misconfiguration on my part?

Reproduction Steps

Expected behavior

Actual behavior

The entirety of the source code starting at the point of assertion failure (in this case line 65 above) is included in the output.

Regression?

This has been occurring for some time (years), but it's finally pushed me to the edge. Thus I'm raising this issue.

Known Workarounds

No response

Configuration

.NET 7
v6.11.0
VS 2022

Other information

I tried doing something akin to this:

Using oScope As New AssertionScope
  oScope.FormattingOptions.MaxLines = 3

End Using

But it had no effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions