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

Ensure assertions do not fail with FormatException #1126

Merged
merged 2 commits into from
Jun 9, 2022

Conversation

Evangelink
Copy link
Member

Update the assertion message construction order to ensure user message is built first (user message could fail with FormatException) and then include this user message in our messages. This switch of order ensure we will never throw FormatException because our built message becomes an invalid format composite.

Fixes dotnet/sdk#25373

Update the assertion message construction order to ensure user message is built first (user message could fail with FormatException) and then include this user message in our messages. This switch of order ensure we will never throw FormatException because our built message becomes an invalid format composite.
@Evangelink Evangelink enabled auto-merge (squash) June 9, 2022 14:22
@Evangelink
Copy link
Member Author

@KalleOlaviNiemitalo This PR should fix all remaining possible FormatException we could have been generating, in case you want to review it too. Description explains the high level algorithm used.

Haplois
Haplois previously approved these changes Jun 9, 2022
@Evangelink Evangelink disabled auto-merge June 9, 2022 14:25
@Evangelink Evangelink enabled auto-merge (squash) June 9, 2022 16:38
@Evangelink Evangelink merged commit 5b4361c into microsoft:main Jun 9, 2022
@Evangelink Evangelink deleted the fix-assertions-stringformat branch June 9, 2022 16:38
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.

Microsoft.VisualStudio.TestTools.UnitTesting.StringAssert("{","x") throws System.FormatException
2 participants