Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The content of "NUnit.Framework.SuccessException" display abnormally. #4116

Closed
vdanche opened this issue May 24, 2022 · 7 comments
Closed

The content of "NUnit.Framework.SuccessException" display abnormally. #4116

vdanche opened this issue May 24, 2022 · 7 comments

Comments

@vdanche
Copy link

vdanche commented May 24, 2022

Affected Branch: Main
Affected Build: Version 17.3.0 Preview 2.0 [32519.311.main]

Steps to reproduce:

  1. Open and extract the project(NUnitTestFx4.5.1.zip)
  2. Debug the project
  3. Observe the Exception window
    NUnitTestFx4.5.1.zip

Note: It is not a regression, it also repro in 16.11.14

Expected Results:
The content of "NUnit.Framework.SuccessException" should display normally.
image

Actual Results:
The content of "NUnit.Framework.SuccessException" display abnormally.
image

dotnet --info
Microsoft Windows [Version 10.0.22000.675]
(c) Microsoft Corporation. All rights reserved.

C:\Users\v-yuqinsong>dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.300
Commit: 8473146e7d

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22000
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.300\

Host (useful for support):
Version: 6.0.5
Commit: 70ae3df4a6

.NET SDKs installed:
6.0.203 [C:\Program Files\dotnet\sdk]
6.0.300 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download

@OsirisTerje
Copy link
Member

This is coming from the NUnit.Framework itself, and is not something that the Adapter handles. I'll transfer the issue to the NUnit.Framework project.

@OsirisTerje OsirisTerje transferred this issue from nunit/nunit3-vs-adapter May 24, 2022
@manfred-brands
Copy link
Member

The '' is the message you passed to Assert.Pass. If you change your code to Assert.Pass("All good") you get:

image

How the message gets displayed is a matter of Visual Studio.
I suspect that they now put single quotes around the message and if the message is empty, it looks what you saw.
The exceptions look the same in both VS2019 and VS2022.

I went all the way back to NUnit version 3.0.0 and the exception pop-up was all the same.

@stevenaw
Copy link
Member

stevenaw commented Dec 5, 2022

I can confirm, I hit this while testing a separate bug report today. I haven't tested different permutations for this but if it's as @manfred-brands says and that the formatting has changed within VS, then I wonder if the solution here would be to define a default message?

@stevenaw
Copy link
Member

stevenaw commented Dec 5, 2022

I'm going to label this an enhancement for further discussion on approach

@mikkelbu
Copy link
Member

mikkelbu commented Dec 13, 2022

Personally, I don't think we should change anything and just accept that this is how it is (meaning how VS shows unhandled exceptions) and then close the issue (we have more than enough issues). In principle we could break people if we added a default message (probably not many - if any at all).

Alternatively, we could change the code, so that Assert.Pass didn't replace null with the empty string - see

if (message == null) message = string.Empty;
- but we do this for all the Assert.XYZ, so here I would be more afraid as I don't know if we have other functionality depending on this never being null.

@stevenaw
Copy link
Member

I'd also be fine with closing it too.
I hadn't thought it a risk to break someone, but if we think there's even a potential for it to then I think it's not worth the risk of changing this

@stevenaw
Copy link
Member

stevenaw commented Jan 2, 2023

I'm going to close this since there doesn't seem to be a strong interest in changing anything here.

@stevenaw stevenaw closed this as not planned Won't fix, can't repro, duplicate, stale Jan 2, 2023
@stevenaw stevenaw added this to the Closed Without Action milestone Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants