Skip to content

Cancellation message fix#1667

Merged
singhsarab merged 5 commits intomicrosoft:masterfrom
singhsarab:CancellationFeedbackFix
Jul 6, 2018
Merged

Cancellation message fix#1667
singhsarab merged 5 commits intomicrosoft:masterfrom
singhsarab:CancellationFeedbackFix

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
<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

}

[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