-
Notifications
You must be signed in to change notification settings - Fork 323
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
Cancellation message fix #1667
Cancellation message fix #1667
Conversation
…nection and LaunchHost
@@ -117,6 +117,9 @@ | |||
<resheader name="writer"> | |||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
</resheader> | |||
<data name="CancellationRequested" xml:space="preserve"> | |||
<value>Cancelling the operation as requested.</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like "The operation was cancelled." seems better. We can check the existing IDE cancellation message to get more input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I just took this as reference. https://github.com/Microsoft/vstest/blob/09057425a192fd329c32bbee2fd9bdd401751450/src/Microsoft.TestPlatform.CrossPlatEngine/Resources/Resources.resx#L180
And I guess we should remove this string.
namespace Microsoft.VisualStudio.TestPlatform.Common.Utilities | ||
{ | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel; | ||
using System.Threading; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
System using at top.
|
||
if (ex is AggregateException && ex.InnerException is TaskCanceledException) | ||
{ | ||
throw new TestPlatformException(Common.Resources.Resources.CancellationRequested); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TaskCanceledException might happen because of something other than cancel also. In that case, we might not want exception to part of TestPlatformException.
Here in case of TaskCancelledException, we can check this.CancellationTokenSource.Token.ThrowTestPlatformExceptionIfCancellationRequested();
which will throw TestPlatformException only in case of cancellation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Done
@@ -402,6 +402,17 @@ public void StartTestRunShouldCatchExceptionAndCallHandleRawMessageAndHandleLogM | |||
mockTestRunEventsHandler.Verify(s => s.HandleLogMessage(TestMessageLevel.Error, It.IsAny<string>())); | |||
} | |||
|
|||
[TestMethod] | |||
public void StartTestRunForCancelRequestShouldHandleLogMessageWithProperErrorMessage() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can have a unit test for case when exception is not testplatformexception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
Description
Fixing error messaging for the cancel during WaitForRequestHandlerConnection and LaunchHost
Related issue
#1661