Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/ResourceManager/Version2016_09_01/AzureRMCmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
using System.Management.Automation;
using System.Net.Http.Headers;
using System.Security.Authentication;
using System.Threading;
using System.Text;

namespace Microsoft.Azure.Commands.ResourceManager.Common
Expand Down Expand Up @@ -298,7 +299,7 @@ protected override void InitializeQosEvent()
{
_qosEvent.SubscriptionId = context.Subscription?.Id;
_qosEvent.TenantId = context.Tenant?.Id;
if(context.Account != null && !String.IsNullOrWhiteSpace(context.Account.Id))
if (context.Account != null && !String.IsNullOrWhiteSpace(context.Account.Id))
{
_qosEvent.Uid = MetricHelper.GenerateSha256HashString(context.Account.Id.ToString());
}
Expand Down Expand Up @@ -546,5 +547,24 @@ private void EnqueueDebugSender(object sender, StreamEventArgs args)
{
DebugMessages.Enqueue(args.Message);
}

private CancellationTokenSource _cancellationtokensource = null;
protected CancellationTokenSource CancelTokenSource
{
get
{
if (_cancellationtokensource == null)
{
_cancellationtokensource = new CancellationTokenSource();
}
return _cancellationtokensource;
}
}

protected override void StopProcessing()
{
CancelTokenSource?.Cancel();
base.StopProcessing();
}
}
}