From 33c6af157737c6bf1db1b6b2457a346a9efff337 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 11 Nov 2015 00:37:16 -0800 Subject: [PATCH] Make more code async. --- .../Diagnostics/UseAutoProperty/UseAutoPropertyTests.cs | 2 +- .../CodeActions/CodeActionEditHandlerService.cs | 2 +- .../Portable/CodeCleanup/AbstractCodeCleanerService.cs | 2 +- .../Rename/ConflictEngine/ConflictResolver.Session.cs | 8 ++++---- .../Core/Portable/Shared/Extensions/DocumentExtensions.cs | 4 ++-- .../Simplification/AbstractSimplificationService.cs | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/UseAutoProperty/UseAutoPropertyTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/UseAutoProperty/UseAutoPropertyTests.cs index 694dd3b74ac..5256646c226 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/UseAutoProperty/UseAutoPropertyTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/UseAutoProperty/UseAutoPropertyTests.cs @@ -266,4 +266,4 @@ public async Task TestAlreadyAutoPropertyWithGetterAndSetterWithNoBody() await TestMissingAsync(@"class Class { public int [|P|] { get; set; } }"); } } -} +} \ No newline at end of file diff --git a/src/EditorFeatures/Core/Implementation/CodeActions/CodeActionEditHandlerService.cs b/src/EditorFeatures/Core/Implementation/CodeActions/CodeActionEditHandlerService.cs index 91fb0bd9e53..26e042358b6 100644 --- a/src/EditorFeatures/Core/Implementation/CodeActions/CodeActionEditHandlerService.cs +++ b/src/EditorFeatures/Core/Implementation/CodeActions/CodeActionEditHandlerService.cs @@ -95,7 +95,7 @@ public void Apply(Workspace workspace, Document fromDocument, IEnumerable spans) IEnumerable spans = null; #if DEBUG - bool originalDocHasErrors = await annotatedDocument.HasAnyErrors(cancellationToken).ConfigureAwait(false); + bool originalDocHasErrors = await annotatedDocument.HasAnyErrorsAsync(cancellationToken).ConfigureAwait(false); #endif var current = 0; diff --git a/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs b/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs index 9ea2c1b0978..7ae95abdc15 100644 --- a/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs +++ b/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs @@ -228,7 +228,7 @@ public async Task ResolveConflictsAsync() } } #if DEBUG - DebugVerifyNoErrors(conflictResolution, _documentsIdsToBeCheckedForConflict); + await DebugVerifyNoErrorsAsync(conflictResolution, _documentsIdsToBeCheckedForConflict).ConfigureAwait(false); #endif return conflictResolution; } @@ -239,7 +239,7 @@ public async Task ResolveConflictsAsync() } #if DEBUG - private void DebugVerifyNoErrors(ConflictResolution conflictResolution, IEnumerable documents) + private async Task DebugVerifyNoErrorsAsync(ConflictResolution conflictResolution, IEnumerable documents) { var documentIdErrorStateLookup = new Dictionary(); @@ -249,7 +249,7 @@ private void DebugVerifyNoErrors(ConflictResolution conflictResolution, IEnumera { // remember if there were issues in the document prior to renaming it. var originalDoc = conflictResolution.OldSolution.GetDocument(documentId); - documentIdErrorStateLookup.Add(documentId, originalDoc.HasAnyErrors(_cancellationToken).WaitAndGetResult(_cancellationToken)); + documentIdErrorStateLookup.Add(documentId, await originalDoc.HasAnyErrorsAsync(_cancellationToken).ConfigureAwait(false)); } // We want to ignore few error message introduced by rename because the user is wantedly doing it. @@ -268,7 +268,7 @@ private void DebugVerifyNoErrors(ConflictResolution conflictResolution, IEnumera // errors. if (!documentIdErrorStateLookup[documentId] && _hasConflictCallback == null) { - conflictResolution.NewSolution.GetDocument(documentId).VerifyNoErrorsAsync("Rename introduced errors in error-free code", _cancellationToken, ignoreErrorCodes).Wait(_cancellationToken); + await conflictResolution.NewSolution.GetDocument(documentId).VerifyNoErrorsAsync("Rename introduced errors in error-free code", _cancellationToken, ignoreErrorCodes).ConfigureAwait(false); } } } diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/DocumentExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/DocumentExtensions.cs index a0e056c3246..ae518eaf991 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/DocumentExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/DocumentExtensions.cs @@ -105,7 +105,7 @@ public static Task GetSemanticModelForNodeAsync(this Document doc } #if DEBUG - public static async Task HasAnyErrors(this Document document, CancellationToken cancellationToken, List ignoreErrorCode = null) + public static async Task HasAnyErrorsAsync(this Document document, CancellationToken cancellationToken, List ignoreErrorCode = null) { if (!document.SupportsSemanticModel) { @@ -122,7 +122,7 @@ public static async Task HasAnyErrors(this Document document, Cancellation /// public static async Task VerifyNoErrorsAsync(this Document newDocument, string message, CancellationToken cancellationToken, List ignoreErrorCodes = null) { - bool newDocumentHasErrors = await newDocument.HasAnyErrors(cancellationToken, ignoreErrorCodes).ConfigureAwait(false); + bool newDocumentHasErrors = await newDocument.HasAnyErrorsAsync(cancellationToken, ignoreErrorCodes).ConfigureAwait(false); Debug.Assert(!newDocumentHasErrors, message); } #endif diff --git a/src/Workspaces/Core/Portable/Simplification/AbstractSimplificationService.cs b/src/Workspaces/Core/Portable/Simplification/AbstractSimplificationService.cs index 7d466989428..c09a44ec1de 100644 --- a/src/Workspaces/Core/Portable/Simplification/AbstractSimplificationService.cs +++ b/src/Workspaces/Core/Portable/Simplification/AbstractSimplificationService.cs @@ -59,7 +59,7 @@ public async Task ReduceAsync(Document document, IEnumerable var root = semanticModel.SyntaxTree.GetRoot(cancellationToken); #if DEBUG - bool originalDocHasErrors = await document.HasAnyErrors(cancellationToken).ConfigureAwait(false); + bool originalDocHasErrors = await document.HasAnyErrorsAsync(cancellationToken).ConfigureAwait(false); #endif var reduced = await this.ReduceAsyncInternal(document, spanList, optionSet, reducers, cancellationToken).ConfigureAwait(false); -- GitLab