Conversation
| @@ -37,8 +37,19 @@ private Assert() | |||
| [DoesNotReturn] | |||
| [StackTraceHidden] | |||
| internal static void ThrowAssertFailed(string assertionName, string? message) | |||
There was a problem hiding this comment.
Given this PR and #2033, I think it'd be good to expose a "ReportFailure" method that could be used by devs extending MSTest assertions so they would benefits from the various features (launch debugger, soft assertions....). I am not doing it here because we can decide not to go with it for now.
| if (scope is not null) | ||
| { | ||
| scope.AddError(assertionFailedException); | ||
| #pragma warning disable CS8763 // A method marked [DoesNotReturn] should not return. |
There was a problem hiding this comment.
@Youssef1313 I don't know what we prefer but it feels better for me to say we continue to help compiler with the default behavior and we know we may have some FPs when code is used under assertion scope. It would otherwise be a breaking change for many people if we had to update all assertion APIs to no longer respect some of these DoesNotReturn compilation indication.
| /// // AssertFailedException is thrown here with all collected failures. | ||
| /// </code> | ||
| /// </example> | ||
| public static IDisposable Scope() => new AssertScope(); |
There was a problem hiding this comment.
Public API is quite limited, do we want to make it experimental still?
Fixes #571