@@ -23,7 +23,7 @@ internal static class CodeFixProviderTestExtensions
2323 /// <returns> A Document with the changes from the CodeAction </returns>
2424 public static Document ApplyFix ( this Document document , CodeAction codeAction )
2525 {
26- var operations = codeAction . GetOperationsAsync ( CancellationToken . None ) . Result ;
26+ var operations = codeAction . GetOperationsAsync ( CancellationToken . None ) . GetAwaiter ( ) . GetResult ( ) ;
2727 var solution = operations . OfType < ApplyChangesOperation > ( ) . Single ( ) . ChangedSolution ;
2828
2929 return solution . GetDocument ( document . Id ) ;
@@ -81,7 +81,7 @@ public static VerifyCodeFixProviderResult VerifyFix(this CodeFixProvider codeFix
8181 {
8282 var actions = new List < CodeAction > ( ) ;
8383 var context = new CodeFixContext ( document , analyzerDiagnostics [ 0 ] , ( a , d ) => actions . Add ( a ) , CancellationToken . None ) ;
84- codeFixProvider . RegisterCodeFixesAsync ( context ) . Wait ( ) ;
84+ codeFixProvider . RegisterCodeFixesAsync ( context ) . GetAwaiter ( ) . GetResult ( ) ;
8585
8686 if ( ! actions . Any ( ) )
8787 {
@@ -104,12 +104,12 @@ public static VerifyCodeFixProviderResult VerifyFix(this CodeFixProvider codeFix
104104 if ( ! allowNewCompilerDiagnostics && newCompilerDiagnostics . Any ( ) )
105105 {
106106 // Format and get the compiler diagnostics again so that the locations make sense in the output
107- document = document . WithSyntaxRoot ( Formatter . Format ( document . GetSyntaxRootAsync ( ) . Result ,
107+ document = document . WithSyntaxRoot ( Formatter . Format ( document . GetSyntaxRootAsync ( ) . GetAwaiter ( ) . GetResult ( ) ,
108108 Formatter . Annotation ,
109109 document . Project . Solution . Workspace ) ) ;
110110
111111 newCompilerDiagnostics = GetNewDiagnostics ( compilerDiagnostics , document . GetCompilerDiagnostics ( ) ) ;
112- var msg = GetNewComilerDiagnosticsIntroducedMessage ( document , newCompilerDiagnostics ) ;
112+ var msg = GetNewCompilerDiagnosticsIntroducedMessage ( document , newCompilerDiagnostics ) ;
113113
114114 return VerifyCodeFixProviderResult . Fail ( msg ) ;
115115 }
@@ -129,10 +129,10 @@ public static VerifyCodeFixProviderResult VerifyFix(this CodeFixProvider codeFix
129129 : VerifyCodeFixProviderResult . Fail ( newSource , actual ) ;
130130 }
131131
132- private static string GetNewComilerDiagnosticsIntroducedMessage ( Document document , IEnumerable < Diagnostic > newCompilerDiagnostics )
132+ private static string GetNewCompilerDiagnosticsIntroducedMessage ( Document document , IEnumerable < Diagnostic > newCompilerDiagnostics )
133133 {
134134 return
135- $ "Fix introduced new compiler diagnostics:{ Environment . NewLine } { string . Join ( "{Environment.NewLine}" , newCompilerDiagnostics . Select ( d => d . ToString ( ) ) ) } { Environment . NewLine } { Environment . NewLine } New document:{ Environment . NewLine } { document . GetSyntaxRootAsync ( ) . Result . ToFullString ( ) } { Environment . NewLine } ";
135+ $ "Fix introduced new compiler diagnostics:{ Environment . NewLine } { string . Join ( "{Environment.NewLine}" , newCompilerDiagnostics . Select ( d => d . ToString ( ) ) ) } { Environment . NewLine } { Environment . NewLine } New document:{ Environment . NewLine } { document . GetSyntaxRootAsync ( ) . GetAwaiter ( ) . GetResult ( ) . ToFullString ( ) } { Environment . NewLine } ";
136136 }
137137
138138 /// <summary>
@@ -145,7 +145,7 @@ private static string GetNewComilerDiagnosticsIntroducedMessage(Document documen
145145 /// <returns> The compiler diagnostics that were found in the code </returns>
146146 private static IEnumerable < Diagnostic > GetCompilerDiagnostics ( this Document document )
147147 {
148- return document . GetSemanticModelAsync ( ) . Result . GetDiagnostics ( ) ;
148+ return document . GetSemanticModelAsync ( ) . GetAwaiter ( ) . GetResult ( ) . GetDiagnostics ( ) ;
149149 }
150150
151151 /// <summary>
@@ -155,8 +155,8 @@ private static IEnumerable<Diagnostic> GetCompilerDiagnostics(this Document docu
155155 /// <returns> A string containing the syntax of the Document after formatting </returns>
156156 public static string GetStringFromDocument ( this Document document )
157157 {
158- var simplifiedDoc = Simplifier . ReduceAsync ( document , Simplifier . Annotation ) . Result ;
159- var root = simplifiedDoc . GetSyntaxRootAsync ( ) . Result ;
158+ var simplifiedDoc = Simplifier . ReduceAsync ( document , Simplifier . Annotation ) . GetAwaiter ( ) . GetResult ( ) ;
159+ var root = simplifiedDoc . GetSyntaxRootAsync ( ) . GetAwaiter ( ) . GetResult ( ) ;
160160 root = Formatter . Format ( root , Formatter . Annotation , simplifiedDoc . Project . Solution . Workspace ) ;
161161
162162 return root . GetText ( ) . ToString ( ) ;
0 commit comments