Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Async Methods when in Async Context Analyzer #5367

Merged
merged 21 commits into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from 9 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
1 change: 1 addition & 0 deletions src/NetAnalyzers/Core/AnalyzerReleases.Unshipped.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CA1845 | Performance | Info | UseSpanBasedStringConcat, [Documentation](https://
CA1846 | Performance | Info | PreferAsSpanOverSubstring, [Documentation](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1846)
CA1847 | Performance | Info | UseStringContainsCharOverloadWithSingleCharactersAnalyzer, [Documentation](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1847)
CA1848 | Performance | Hidden | LoggerMessageDefineAnalyzer, [Documentation](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848)
CA1849 | Performance | Info | UseAsyncMethodInAsyncContext, [Documentation](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1849)
CA2017 | Reliability | Warning | LoggerMessageDefineAnalyzer, [Documentation](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2017)
CA2018 | Reliability | Warning | BufferBlockCopyLengthAnalyzer, [Documentation](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2018)
CA2250 | Usage | Info | UseCancellationTokenThrowIfCancellationRequested, [Documentation](https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2250)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1764,4 +1764,17 @@
<data name="ModuleInitializerAttributeShouldNotBeUsedInLibrariesTitle" xml:space="preserve">
<value>The 'ModuleInitializer' attribute should not be used in libraries</value>
</data>
<data name="UseAsyncMethodInAsyncContextMessage" xml:space="preserve">
<value>'{0}' synchronously blocks. Await '{1}' instead.</value>
</data>
<data name="UseAsyncMethodInAsyncContextTitle" xml:space="preserve">
<value>Call async methods when in an async method</value>
</data>
<data name="UseAsyncMethodInAsyncContextMessage_NoAlternative" xml:space="preserve">
<value>'{0}' synchronously blocks. Use await instead.</value>
</data>
<data name="UseAsyncMethodInAsyncContextDescription" xml:space="preserve">
<value>When inside a Task-returning method, use the async version of methods, if they exist.</value>
mahdiva marked this conversation as resolved.
Show resolved Hide resolved
<comment>{Locked="Task"}</comment>
</data>
</root>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2357,6 +2357,26 @@
<target state="translated">Indexer hodnot pole založený na rozsahu vytváří kopii požadované části pole. Když se implicitně používá jako hodnota ReadOnlySpan nebo ReadOnlyMemory, je tato kopie obvykle zbytečná. Pokud se jí chcete vyhnout, použijte metodu AsSpan.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextDescription">
<source>When inside a Task-returning method, use the async version of methods, if they exist.</source>
<target state="new">When inside a Task-returning method, use the async version of methods, if they exist.</target>
<note>{Locked="Task"}</note>
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage">
<source>'{0}' synchronously blocks. Await '{1}' instead.</source>
<target state="new">'{0}' synchronously blocks. Await '{1}' instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage_NoAlternative">
<source>'{0}' synchronously blocks. Use await instead.</source>
<target state="new">'{0}' synchronously blocks. Use await instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextTitle">
<source>Call async methods when in an async method</source>
<target state="new">Call async methods when in an async method</target>
<note />
</trans-unit>
<trans-unit id="UseAutoValidateAntiforgeryToken">
<source>Use antiforgery tokens in ASP.NET Core MVC controllers</source>
<target state="translated">Používat tokeny proti padělkům v kontrolerech MVC ASP.NET Core</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2357,6 +2357,26 @@
<target state="translated">Der Range-basierte Indexer für Arraywerte erzeugt eine Kopie des angeforderten Teils des Arrays. Diese Kopie ist bei der impliziten Verwendung als ReadOnlySpan- oder ReadOnlyMemory-Wert in der Regel nicht notwendig. Verwenden Sie die AsSpan-Methode, um die nicht benötigte Kopie zu vermeiden.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextDescription">
<source>When inside a Task-returning method, use the async version of methods, if they exist.</source>
<target state="new">When inside a Task-returning method, use the async version of methods, if they exist.</target>
<note>{Locked="Task"}</note>
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage">
<source>'{0}' synchronously blocks. Await '{1}' instead.</source>
<target state="new">'{0}' synchronously blocks. Await '{1}' instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage_NoAlternative">
<source>'{0}' synchronously blocks. Use await instead.</source>
<target state="new">'{0}' synchronously blocks. Use await instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextTitle">
<source>Call async methods when in an async method</source>
<target state="new">Call async methods when in an async method</target>
<note />
</trans-unit>
<trans-unit id="UseAutoValidateAntiforgeryToken">
<source>Use antiforgery tokens in ASP.NET Core MVC controllers</source>
<target state="translated">Fälschungssicherheitstoken in ASP.NET Core MVC-Controllern verwenden</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2357,6 +2357,26 @@
<target state="translated">El indizador basado en intervalos en los valores de matriz genera una copia de la parte solicitada de la matriz. Esta copia suele ser innecesaria cuando se usa implícitamente como valor ReadOnlySpan o ReadOnlyMemory. Use el método AsSpan para evitar la copia innecesaria.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextDescription">
<source>When inside a Task-returning method, use the async version of methods, if they exist.</source>
<target state="new">When inside a Task-returning method, use the async version of methods, if they exist.</target>
<note>{Locked="Task"}</note>
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage">
<source>'{0}' synchronously blocks. Await '{1}' instead.</source>
<target state="new">'{0}' synchronously blocks. Await '{1}' instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage_NoAlternative">
<source>'{0}' synchronously blocks. Use await instead.</source>
<target state="new">'{0}' synchronously blocks. Use await instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextTitle">
<source>Call async methods when in an async method</source>
<target state="new">Call async methods when in an async method</target>
<note />
</trans-unit>
<trans-unit id="UseAutoValidateAntiforgeryToken">
<source>Use antiforgery tokens in ASP.NET Core MVC controllers</source>
<target state="translated">Usar tokens antifalsificación en los controladores de ASP.NET Core MVC</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2357,6 +2357,26 @@
<target state="translated">L'indexeur basé sur Range pour les valeurs de tableau produit une copie de la partie demandée du tableau. Cette copie est généralement inutile quand elle est implicitement utilisée en tant que valeur ReadOnlySpan ou ReadOnlyMemory. Utilisez la méthode AsSpan pour éviter toute copie inutile.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextDescription">
<source>When inside a Task-returning method, use the async version of methods, if they exist.</source>
<target state="new">When inside a Task-returning method, use the async version of methods, if they exist.</target>
<note>{Locked="Task"}</note>
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage">
<source>'{0}' synchronously blocks. Await '{1}' instead.</source>
<target state="new">'{0}' synchronously blocks. Await '{1}' instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage_NoAlternative">
<source>'{0}' synchronously blocks. Use await instead.</source>
<target state="new">'{0}' synchronously blocks. Use await instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextTitle">
<source>Call async methods when in an async method</source>
<target state="new">Call async methods when in an async method</target>
<note />
</trans-unit>
<trans-unit id="UseAutoValidateAntiforgeryToken">
<source>Use antiforgery tokens in ASP.NET Core MVC controllers</source>
<target state="translated">Utilisez des jetons antifalsification dans les contrôleurs ASP.NET Core MVC</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2357,6 +2357,26 @@
<target state="translated">Con l'indicizzatore basato su Range su valori di matrice viene prodotta una copia della porzione richiesta della matrice. Questa copia è in genere non necessaria quando viene usata in modo implicito come valore di ReadOnlySpan o ReadOnlyMemory. Per evitare la copia non necessaria, usare il metodo AsSpan.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextDescription">
<source>When inside a Task-returning method, use the async version of methods, if they exist.</source>
<target state="new">When inside a Task-returning method, use the async version of methods, if they exist.</target>
<note>{Locked="Task"}</note>
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage">
<source>'{0}' synchronously blocks. Await '{1}' instead.</source>
<target state="new">'{0}' synchronously blocks. Await '{1}' instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage_NoAlternative">
<source>'{0}' synchronously blocks. Use await instead.</source>
<target state="new">'{0}' synchronously blocks. Use await instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextTitle">
<source>Call async methods when in an async method</source>
<target state="new">Call async methods when in an async method</target>
<note />
</trans-unit>
<trans-unit id="UseAutoValidateAntiforgeryToken">
<source>Use antiforgery tokens in ASP.NET Core MVC controllers</source>
<target state="translated">Usare token antifalsificazione nei controller MVC ASP.NET Core</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2357,6 +2357,26 @@
<target state="translated">配列値に対して範囲ベースのインデクサーを使用すると、要求された配列の部分のコピーが作成されます。ReadOnlySpan または ReadOnlyMemory 値として暗黙的に使用される場合、このコピーは不要であることが少なくありません。不要なコピーを回避するには、AsSpan メソッドをご使用ください。</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextDescription">
<source>When inside a Task-returning method, use the async version of methods, if they exist.</source>
<target state="new">When inside a Task-returning method, use the async version of methods, if they exist.</target>
<note>{Locked="Task"}</note>
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage">
<source>'{0}' synchronously blocks. Await '{1}' instead.</source>
<target state="new">'{0}' synchronously blocks. Await '{1}' instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage_NoAlternative">
<source>'{0}' synchronously blocks. Use await instead.</source>
<target state="new">'{0}' synchronously blocks. Use await instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextTitle">
<source>Call async methods when in an async method</source>
<target state="new">Call async methods when in an async method</target>
<note />
</trans-unit>
<trans-unit id="UseAutoValidateAntiforgeryToken">
<source>Use antiforgery tokens in ASP.NET Core MVC controllers</source>
<target state="translated">ASP.NET Core MVC コントローラーで偽造防止トークンを使用する</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2357,6 +2357,26 @@
<target state="translated">배열 값에 대한 범위 기반 인덱서는 배열의 요청된 부분의 복사본을 생성합니다. 이 복사본은 암시적으로 ReadOnlySpan 또는 ReadOnlyMemory 값으로 사용될 경우 대개 필요하지 않습니다. 불필요한 복사본이 생성되지 않도록 하려면 AsSpan 메서드를 사용하세요.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextDescription">
<source>When inside a Task-returning method, use the async version of methods, if they exist.</source>
<target state="new">When inside a Task-returning method, use the async version of methods, if they exist.</target>
<note>{Locked="Task"}</note>
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage">
<source>'{0}' synchronously blocks. Await '{1}' instead.</source>
<target state="new">'{0}' synchronously blocks. Await '{1}' instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage_NoAlternative">
<source>'{0}' synchronously blocks. Use await instead.</source>
<target state="new">'{0}' synchronously blocks. Use await instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextTitle">
<source>Call async methods when in an async method</source>
<target state="new">Call async methods when in an async method</target>
<note />
</trans-unit>
<trans-unit id="UseAutoValidateAntiforgeryToken">
<source>Use antiforgery tokens in ASP.NET Core MVC controllers</source>
<target state="translated">ASP.NET Core MVC 컨트롤러에서 위조 방지 토큰 사용</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2357,6 +2357,26 @@
<target state="translated">Użycie indeksatora opartego na zakresie w przypadku wartości tablicy powoduje utworzenie kopii żądanej części tablicy. Ta kopia jest zwykle niepotrzebna, gdy jest niejawnie używana jako wartość ReadOnlySpan lub ReadOnlyMemory. Użyj metody AsSpan, aby uniknąć zbędnego kopiowania.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextDescription">
<source>When inside a Task-returning method, use the async version of methods, if they exist.</source>
<target state="new">When inside a Task-returning method, use the async version of methods, if they exist.</target>
<note>{Locked="Task"}</note>
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage">
<source>'{0}' synchronously blocks. Await '{1}' instead.</source>
<target state="new">'{0}' synchronously blocks. Await '{1}' instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage_NoAlternative">
<source>'{0}' synchronously blocks. Use await instead.</source>
<target state="new">'{0}' synchronously blocks. Use await instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextTitle">
<source>Call async methods when in an async method</source>
<target state="new">Call async methods when in an async method</target>
<note />
</trans-unit>
<trans-unit id="UseAutoValidateAntiforgeryToken">
<source>Use antiforgery tokens in ASP.NET Core MVC controllers</source>
<target state="translated">Użyj tokenów zabezpieczających przed fałszerstwem w kontrolerach MVC ASP.NET Core</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2357,6 +2357,26 @@
<target state="translated">O Indexador baseado em intervalo em valores de matriz produz uma cópia da porção solicitada da matriz. Essa cópia normalmente é desnecessária quando é usada implicitamente como um valor de ReadOnlySpan ou de ReadOnlyMemory. Use o método AsSpan para evitar a cópia desnecessária.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextDescription">
<source>When inside a Task-returning method, use the async version of methods, if they exist.</source>
<target state="new">When inside a Task-returning method, use the async version of methods, if they exist.</target>
<note>{Locked="Task"}</note>
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage">
<source>'{0}' synchronously blocks. Await '{1}' instead.</source>
<target state="new">'{0}' synchronously blocks. Await '{1}' instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextMessage_NoAlternative">
<source>'{0}' synchronously blocks. Use await instead.</source>
<target state="new">'{0}' synchronously blocks. Use await instead.</target>
<note />
</trans-unit>
<trans-unit id="UseAsyncMethodInAsyncContextTitle">
<source>Call async methods when in an async method</source>
<target state="new">Call async methods when in an async method</target>
<note />
</trans-unit>
<trans-unit id="UseAutoValidateAntiforgeryToken">
<source>Use antiforgery tokens in ASP.NET Core MVC controllers</source>
<target state="translated">Usar tokens antifalsificação em controladores MVC do ASP.NET Core</target>
Expand Down
Loading