Skip to content

Commit e527f5d

Browse files
authored
Merge pull request #165 from msJinLei/disablecontextautosave
Disable context auto saving when AzureRmContext.json not available
2 parents 7e826d2 + ff8a844 commit e527f5d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Common/AzurePSCmdlet.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public abstract class AzurePSCmdlet : PSCmdlet, IDisposable
4040

4141
public ConcurrentQueue<string> DebugMessages { get; private set; }
4242

43+
protected static ConcurrentQueue<string> InitializationWarnings { get; set; } = new ConcurrentQueue<string>();
44+
4345
private RecordingTracingInterceptor _httpTracingInterceptor;
4446
private object lockObject = new object();
4547
private AzurePSDataCollectionProfile _cachedProfile = null;
@@ -341,6 +343,7 @@ protected virtual void TearDownHttpClientPipeline()
341343
/// </summary>
342344
protected override void BeginProcessing()
343345
{
346+
FlushInitializationWarnings();
344347
SessionState = base.SessionState;
345348
var profile = _dataCollectionProfile;
346349
//TODO: Inject from CI server
@@ -542,6 +545,20 @@ private void FlushDebugMessages(bool record = false)
542545
}
543546
}
544547

548+
public void WriteInitializationWarnings(string message)
549+
{
550+
InitializationWarnings.Enqueue(message);
551+
}
552+
553+
protected void FlushInitializationWarnings()
554+
{
555+
string message;
556+
while (InitializationWarnings.TryDequeue(out message))
557+
{
558+
base.WriteWarning(message);
559+
}
560+
}
561+
545562
protected abstract void InitializeQosEvent();
546563

547564
private void RecordDebugMessages()

0 commit comments

Comments
 (0)