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

Cancellation message fix #1667

Merged
merged 5 commits into from
Jul 6, 2018

Conversation

singhsarab
Copy link
Contributor

Description

Fixing error messaging for the cancel during WaitForRequestHandlerConnection and LaunchHost

Related issue

#1661

@singhsarab singhsarab requested a review from abhishkk July 2, 2018 17:48
@@ -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>
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

namespace Microsoft.VisualStudio.TestPlatform.Common.Utilities
{
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using System.Threading;
Copy link
Contributor

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);
Copy link
Contributor

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.

Copy link
Contributor Author

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()
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

@singhsarab singhsarab merged commit a4c5506 into microsoft:master Jul 6, 2018
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.

2 participants