Assertion failure text includes excessive source code
See original GitHub issueDescription
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.
Issue Analytics
- State:
- Created a month ago
- Comments:14 (6 by maintainers)
Top GitHub Comments
FYI, I’ve merged a PR that improves the caller identification for VB. I also noticed that if you
Should()
instead of the shorthandShould
, the current version of FA Should work as expected.@dennisdoomen
Ah, gotcha.
Well… here’s what I’ve done as a workaround, based on @jnyrup’s suggestion:
I dropped that as a double-click-to-paste template into my VS Toolbox pane and it works just fine. I can live with that if you’ve got better things to do than worry with this whole thing (and I suspect you do).
Here’s my new output:
Luv it. I can get back to work now. And I think you should too.
Thanks @jnyrup!