Skip to content

Delete AssertEx.Throws#52183

Merged
jasonmalinowski merged 1 commit intodotnet:mainfrom
jasonmalinowski:remove-assertex.throws
Mar 29, 2021
Merged

Delete AssertEx.Throws#52183
jasonmalinowski merged 1 commit intodotnet:mainfrom
jasonmalinowski:remove-assertex.throws

Conversation

@jasonmalinowski
Copy link
Member

@jasonmalinowski jasonmalinowski commented Mar 27, 2021

We're not entirely sure why this was added; it might have been due to lack of Assert.ThrowsAsync in whichever version of xUnit we were using, or something else. In any case, it's unnecessary today and was also broken: it would silently succeed if the passed function didn't throw any exceptions at all.

@jasonmalinowski jasonmalinowski requested review from a team as code owners March 27, 2021 01:23
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Observe that if this didn't throw, the test might silently pass.

We're not entirely sure why this was added; it might have been due
to lack of Assert.ThrowsAsync in whichever version of xUnit we were
using, or something else. In any case, it's unnecessary today and was
also broken: it would silently succeed if the passed function didn't
throw any exceptions at all.
@jasonmalinowski jasonmalinowski force-pushed the remove-assertex.throws branch from 8ec6238 to 87bfc80 Compare March 27, 2021 01:26
Comment on lines +2540 to +2543
using var workspace = CreateMSBuildWorkspace();
await workspace.OpenProjectAsync(projectFile);
var diagnostic = Assert.Single(workspace.Diagnostics);
Assert.Contains("The process cannot access the file", diagnostic.Message);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is asserting what the code actually does. It didn't throw an exception, and since AssertEx.Throws was bugged, we never saw.

@jasonmalinowski
Copy link
Member Author

@JoeRobich has given me permission to merge even though this breaks his PR. 😄

@jasonmalinowski jasonmalinowski merged commit b9034c4 into dotnet:main Mar 29, 2021
@ghost ghost added this to the Next milestone Mar 29, 2021
@jasonmalinowski jasonmalinowski deleted the remove-assertex.throws branch March 29, 2021 23:05
@allisonchou allisonchou modified the milestones: Next, 16.10.P2 Mar 29, 2021
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.

6 participants