Rename VSTHRD010 given its data-driven nature

This commit is contained in:
Andrew Arnott 2018-02-18 21:30:30 -08:00
Родитель 3a9896116c
Коммит 61da424428
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: A9B9910CDCCDA441
32 изменённых файлов: 267 добавлений и 97 удалений

Просмотреть файл

@ -1,4 +1,4 @@
# VSTHRD010 Use VS services from UI thread
# VSTHRD010 Invoke single-threaded types on Main thread
Acquiring, casting, or invoking Visual Studio services should be done after ensuring
that your code is running on the UI thread.

Просмотреть файл

@ -8,7 +8,7 @@ ID | Title | Severity | Supports
[VSTHRD001](VSTHRD001.md) | Use JTF.SwitchToMainThread to switch | Critical | [1st rule](../threading_rules.md#Rule1)
[VSTHRD002](VSTHRD002.md) | Use JTF.Run to block | Critical | [2nd rule](../threading_rules.md#Rule2)
[VSTHRD003](VSTHRD003.md) | Use JTF.RunAsync to block later | Critical | [3rd rule](../threading_rules.md#Rule3)
[VSTHRD010](VSTHRD010.md) | Use VS services from UI thread | Critical | [1st rule](../threading_rules.md#Rule1)
[VSTHRD010](VSTHRD010.md) | Invoke single-threaded types on Main thread | Critical | [1st rule](../threading_rules.md#Rule1)
[VSTHRD011](VSTHRD011.md) | Avoid using `Lazy<T>` where `T` is `Task<T2>` | Critical | [3rd rule](../threading_rules.md#Rule3)
[VSTHRD012](VSTHRD012.md) | Provide JoinableTaskFactory where allowed | Critical | [All rules](../threading_rules.md)
[VSTHRD100](VSTHRD100.md) | Avoid `async void` methods | Advisory

Просмотреть файл

@ -6,23 +6,23 @@
using Xunit;
using Xunit.Abstractions;
public class VSTHRD010VsServiceInvocationAnalyzerTests : DiagnosticVerifier
public class VSTHRD010MainThreadUsageAnalyzerTests : DiagnosticVerifier
{
private DiagnosticResult expect = new DiagnosticResult
{
Id = VSTHRD010VsServiceUsageAnalyzer.Id,
Id = VSTHRD010MainThreadUsageAnalyzer.Id,
SkipVerifyMessage = true,
Severity = DiagnosticSeverity.Warning,
};
public VSTHRD010VsServiceInvocationAnalyzerTests(ITestOutputHelper logger)
public VSTHRD010MainThreadUsageAnalyzerTests(ITestOutputHelper logger)
: base(logger)
{
}
protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
{
return new VSTHRD010VsServiceUsageAnalyzer();
return new VSTHRD010MainThreadUsageAnalyzer();
}
[Fact]

Просмотреть файл

@ -27,14 +27,17 @@
<target state="translated">Vyhněte se problematickým synchronním čekáním</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat" translate="yes" xml:space="preserve">
<source>Visual Studio service "{0}" should be used on main thread explicitly.
Call ThreadHelper.ThrowIfNotOnUIThread() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="translated">Službu Visual Studio {0} je třeba používat explicitně v hlavním vlákně.
<source>The type "{0}" should be used on main thread explicitly.
Call {1}() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="needs-review-translation">Službu Visual Studio {0} je třeba používat explicitně v hlavním vlákně.
Nejprve zavolejte ThreadHelper.ThrowIfNotOnUIThread() nebo počkejte na JoinableTaskFactory.SwitchToMainThreadAsync().</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
<trans-unit id="VSTHRD010_Title" translate="yes" xml:space="preserve">
<source>Use VS services from UI thread</source>
<target state="translated">Použití služeb VS z vlákna uživatelského rozhraní</target>
<source>Invoke single-threaded types on Main thread</source>
<target state="needs-review-translation">Použití služeb VS z vlákna uživatelského rozhraní</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
</trans-unit>
<trans-unit id="VSTHRD100_MessageFormat" translate="yes" xml:space="preserve">
<source>Avoid "async void" methods, because any exceptions not handled by the method will crash the process.</source>
@ -182,6 +185,13 @@ Použijte raději AsyncLazy&lt;T&gt;.</target>
<source>Assert thread affinity unconditionally</source>
<target state="new">Assert thread affinity unconditionally</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat_NoAssertingMethod" translate="yes" xml:space="preserve">
<source>The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="new">The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</target>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
</group>
</body>
</file>

Просмотреть файл

@ -27,14 +27,17 @@
<target state="translated">Problematische synchrone Wartevorgänge vermeiden</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat" translate="yes" xml:space="preserve">
<source>Visual Studio service "{0}" should be used on main thread explicitly.
Call ThreadHelper.ThrowIfNotOnUIThread() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="translated">Der Visual Studio-Dienst "{0}" sollte explizit im Hauptthread verwendet werden.
<source>The type "{0}" should be used on main thread explicitly.
Call {1}() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="needs-review-translation">Der Visual Studio-Dienst "{0}" sollte explizit im Hauptthread verwendet werden.
Rufen Sie "ThreadHelper.ThrowIfNotOnUIThread()" auf, oder warten Sie zuerst auf "JoinableTaskFactory.SwitchToMainThreadAsync()".</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
<trans-unit id="VSTHRD010_Title" translate="yes" xml:space="preserve">
<source>Use VS services from UI thread</source>
<target state="translated">VS-Dienste aus dem UI-Thread verwenden</target>
<source>Invoke single-threaded types on Main thread</source>
<target state="needs-review-translation">VS-Dienste aus dem UI-Thread verwenden</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
</trans-unit>
<trans-unit id="VSTHRD100_MessageFormat" translate="yes" xml:space="preserve">
<source>Avoid "async void" methods, because any exceptions not handled by the method will crash the process.</source>
@ -182,6 +185,13 @@ Verwenden Sie stattdessen "AsyncLazy&lt;T&gt;".</target>
<source>Assert thread affinity unconditionally</source>
<target state="new">Assert thread affinity unconditionally</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat_NoAssertingMethod" translate="yes" xml:space="preserve">
<source>The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="new">The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</target>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
</group>
</body>
</file>

Просмотреть файл

@ -27,14 +27,17 @@
<target state="translated">Evite esperas sincrónicas problemáticas</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat" translate="yes" xml:space="preserve">
<source>Visual Studio service "{0}" should be used on main thread explicitly.
Call ThreadHelper.ThrowIfNotOnUIThread() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="translated">El servicio "{0}" de Visual Studio debe usarse explícitamente en el subproceso principal.
<source>The type "{0}" should be used on main thread explicitly.
Call {1}() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="needs-review-translation">El servicio "{0}" de Visual Studio debe usarse explícitamente en el subproceso principal.
Llame a ThreadHelper.ThrowIfNotOnUIThread() o el elemento await JoinableTaskFactory.SwitchToMainThreadAsync() en primer lugar.</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
<trans-unit id="VSTHRD010_Title" translate="yes" xml:space="preserve">
<source>Use VS services from UI thread</source>
<target state="translated">Use servicios de VS desde el subproceso de IU</target>
<source>Invoke single-threaded types on Main thread</source>
<target state="needs-review-translation">Use servicios de VS desde el subproceso de IU</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
</trans-unit>
<trans-unit id="VSTHRD100_MessageFormat" translate="yes" xml:space="preserve">
<source>Avoid "async void" methods, because any exceptions not handled by the method will crash the process.</source>
@ -182,6 +185,13 @@ Use AsyncLazy&lt;T&gt; en su lugar.</target>
<source>Assert thread affinity unconditionally</source>
<target state="new">Assert thread affinity unconditionally</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat_NoAssertingMethod" translate="yes" xml:space="preserve">
<source>The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="new">The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</target>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
</group>
</body>
</file>

Просмотреть файл

@ -27,14 +27,17 @@
<target state="translated">Éviter les attentes synchrones problématiques</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat" translate="yes" xml:space="preserve">
<source>Visual Studio service "{0}" should be used on main thread explicitly.
Call ThreadHelper.ThrowIfNotOnUIThread() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="translated">Le service Visual Studio "{0}"doit être utilisé sur le thread principal de manière explicite.
<source>The type "{0}" should be used on main thread explicitly.
Call {1}() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="needs-review-translation">Le service Visual Studio "{0}"doit être utilisé sur le thread principal de manière explicite.
Appelez ThreadHelper.ThrowIfNotOnUIThread() ou attendez d'abord JoinableTaskFactory.SwitchToMainThreadAsync().</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
<trans-unit id="VSTHRD010_Title" translate="yes" xml:space="preserve">
<source>Use VS services from UI thread</source>
<target state="translated">Utiliser les services VS à partir du thread dinterface utilisateur</target>
<source>Invoke single-threaded types on Main thread</source>
<target state="needs-review-translation">Utiliser les services VS à partir du thread dinterface utilisateur</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
</trans-unit>
<trans-unit id="VSTHRD100_MessageFormat" translate="yes" xml:space="preserve">
<source>Avoid "async void" methods, because any exceptions not handled by the method will crash the process.</source>
@ -182,6 +185,13 @@ Utilisez AsyncLazy&lt;T&gt; à la place</target>
<source>Assert thread affinity unconditionally</source>
<target state="new">Assert thread affinity unconditionally</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat_NoAssertingMethod" translate="yes" xml:space="preserve">
<source>The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="new">The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</target>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
</group>
</body>
</file>

Просмотреть файл

@ -27,14 +27,17 @@
<target state="translated">Evita attese sincrone problematiche</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat" translate="yes" xml:space="preserve">
<source>Visual Studio service "{0}" should be used on main thread explicitly.
Call ThreadHelper.ThrowIfNotOnUIThread() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="translated">Il servizio "{0}" di Visual Studio non deve essere usato sul thread principale in modo esplicito.
<source>The type "{0}" should be used on main thread explicitly.
Call {1}() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="needs-review-translation">Il servizio "{0}" di Visual Studio non deve essere usato sul thread principale in modo esplicito.
Chiamare prima ThreadHelper.ThrowIfNotOnUIThread() o await JoinableTaskFactory.SwitchToMainThreadAsync().</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
<trans-unit id="VSTHRD010_Title" translate="yes" xml:space="preserve">
<source>Use VS services from UI thread</source>
<target state="translated">Usa i servizi di Visual Studio dal thread dell'interfaccia utente</target>
<source>Invoke single-threaded types on Main thread</source>
<target state="needs-review-translation">Usa i servizi di Visual Studio dal thread dell'interfaccia utente</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
</trans-unit>
<trans-unit id="VSTHRD100_MessageFormat" translate="yes" xml:space="preserve">
<source>Avoid "async void" methods, because any exceptions not handled by the method will crash the process.</source>
@ -182,6 +185,13 @@ In alternativa, usare AsyncLazy&lt;T&gt;.</target>
<source>Assert thread affinity unconditionally</source>
<target state="new">Assert thread affinity unconditionally</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat_NoAssertingMethod" translate="yes" xml:space="preserve">
<source>The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="new">The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</target>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
</group>
</body>
</file>

Просмотреть файл

@ -27,14 +27,17 @@
<target state="translated">問題のある同期待機を避ける</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat" translate="yes" xml:space="preserve">
<source>Visual Studio service "{0}" should be used on main thread explicitly.
Call ThreadHelper.ThrowIfNotOnUIThread() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="translated">Visual Studio サービス "{0}" は、明示的にメイン スレッドで使用する必要があります。
<source>The type "{0}" should be used on main thread explicitly.
Call {1}() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="needs-review-translation">Visual Studio サービス "{0}" は、明示的にメイン スレッドで使用する必要があります。
ThreadHelper.ThrowIfNotOnUIThread() を呼び出すか、まず JoinableTaskFactory.SwitchToMainThreadAsync() を待機してください。</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
<trans-unit id="VSTHRD010_Title" translate="yes" xml:space="preserve">
<source>Use VS services from UI thread</source>
<target state="translated">UI スレッドから VS サービスを使用する</target>
<source>Invoke single-threaded types on Main thread</source>
<target state="needs-review-translation">UI スレッドから VS サービスを使用する</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
</trans-unit>
<trans-unit id="VSTHRD100_MessageFormat" translate="yes" xml:space="preserve">
<source>Avoid "async void" methods, because any exceptions not handled by the method will crash the process.</source>
@ -182,6 +185,13 @@ Use AsyncLazy&lt;T&gt; instead.</source>
<source>Assert thread affinity unconditionally</source>
<target state="new">Assert thread affinity unconditionally</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat_NoAssertingMethod" translate="yes" xml:space="preserve">
<source>The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="new">The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</target>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
</group>
</body>
</file>

Просмотреть файл

@ -27,14 +27,17 @@
<target state="translated">문제가 있는 동기 대기를 사용하지 않습니다.</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat" translate="yes" xml:space="preserve">
<source>Visual Studio service "{0}" should be used on main thread explicitly.
Call ThreadHelper.ThrowIfNotOnUIThread() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="translated">주 스레드에서 Visual Studio 서비스 "{0}"을(를) 명시적으로 사용해야 합니다.
<source>The type "{0}" should be used on main thread explicitly.
Call {1}() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="needs-review-translation">주 스레드에서 Visual Studio 서비스 "{0}"을(를) 명시적으로 사용해야 합니다.
ThreadHelper.ThrowIfNotOnUIThread()를 호출하거나, 우선 JoinableTaskFactory.SwitchToMainThreadAsync()를 대기합니다.</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
<trans-unit id="VSTHRD010_Title" translate="yes" xml:space="preserve">
<source>Use VS services from UI thread</source>
<target state="translated">UI 스레드의 VS 서비스를 사용합니다.</target>
<source>Invoke single-threaded types on Main thread</source>
<target state="needs-review-translation">UI 스레드의 VS 서비스를 사용합니다.</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
</trans-unit>
<trans-unit id="VSTHRD100_CodeFix_Title" translate="yes" xml:space="preserve">
<source>Change return type to Task</source>
@ -182,6 +185,13 @@ Use AsyncLazy&lt;T&gt; instead.</source>
<source>Assert thread affinity unconditionally</source>
<target state="new">Assert thread affinity unconditionally</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat_NoAssertingMethod" translate="yes" xml:space="preserve">
<source>The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="new">The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</target>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
</group>
</body>
</file>

Просмотреть файл

@ -27,14 +27,17 @@
<target state="translated">Unikaj problematycznych oczekiwań synchronicznych</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat" translate="yes" xml:space="preserve">
<source>Visual Studio service "{0}" should be used on main thread explicitly.
Call ThreadHelper.ThrowIfNotOnUIThread() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="translated">Usługa programu Visual Studio „{0}” powinna być używana w wątku głównym w sposób jawny.
<source>The type "{0}" should be used on main thread explicitly.
Call {1}() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="needs-review-translation">Usługa programu Visual Studio „{0}” powinna być używana w wątku głównym w sposób jawny.
Najpierw wywołaj metodę ThreadHelper.ThrowIfNotOnUIThread() lub oczekuj na metodę JoinableTaskFactory.SwitchToMainThreadAsync().</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
<trans-unit id="VSTHRD010_Title" translate="yes" xml:space="preserve">
<source>Use VS services from UI thread</source>
<target state="translated">Używaj usług programu VS z wątku interfejsu użytkownika</target>
<source>Invoke single-threaded types on Main thread</source>
<target state="needs-review-translation">Używaj usług programu VS z wątku interfejsu użytkownika</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
</trans-unit>
<trans-unit id="VSTHRD100_MessageFormat" translate="yes" xml:space="preserve">
<source>Avoid "async void" methods, because any exceptions not handled by the method will crash the process.</source>
@ -182,6 +185,13 @@ Zamiast tego używaj klasy AsyncLazy&lt;T&gt;.</target>
<source>Assert thread affinity unconditionally</source>
<target state="new">Assert thread affinity unconditionally</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat_NoAssertingMethod" translate="yes" xml:space="preserve">
<source>The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="new">The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</target>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
</group>
</body>
</file>

Просмотреть файл

@ -27,14 +27,17 @@
<target state="translated">Evite esperas síncronas problemáticas</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat" translate="yes" xml:space="preserve">
<source>Visual Studio service "{0}" should be used on main thread explicitly.
Call ThreadHelper.ThrowIfNotOnUIThread() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="translated">O serviço do Visual Studio "{0}" deve ser usado em um thread principal explicitamente.
<source>The type "{0}" should be used on main thread explicitly.
Call {1}() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="needs-review-translation">O serviço do Visual Studio "{0}" deve ser usado em um thread principal explicitamente.
Chame ThreadHelper.ThrowIfNotOnUIThread() ou espere primeiro pelo JoinableTaskFactory.SwitchToMainThreadAsync().</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
<trans-unit id="VSTHRD010_Title" translate="yes" xml:space="preserve">
<source>Use VS services from UI thread</source>
<target state="translated">Use serviços do VS do thread de interface do usuário</target>
<source>Invoke single-threaded types on Main thread</source>
<target state="needs-review-translation">Use serviços do VS do thread de interface do usuário</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
</trans-unit>
<trans-unit id="VSTHRD100_MessageFormat" translate="yes" xml:space="preserve">
<source>Avoid "async void" methods, because any exceptions not handled by the method will crash the process.</source>
@ -182,6 +185,13 @@ Em vez disso, use AsyncLazy&lt;T&gt;.</target>
<source>Assert thread affinity unconditionally</source>
<target state="new">Assert thread affinity unconditionally</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat_NoAssertingMethod" translate="yes" xml:space="preserve">
<source>The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="new">The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</target>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
</group>
</body>
</file>

Просмотреть файл

@ -27,14 +27,17 @@
<target state="translated">Избегание проблемных синхронных ожиданий</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat" translate="yes" xml:space="preserve">
<source>Visual Studio service "{0}" should be used on main thread explicitly.
Call ThreadHelper.ThrowIfNotOnUIThread() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="translated">Службу Visual Studio "{0}" следует явно использовать в основном потоке.
<source>The type "{0}" should be used on main thread explicitly.
Call {1}() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="needs-review-translation">Службу Visual Studio "{0}" следует явно использовать в основном потоке.
Сначала вызовите ThreadHelper.ThrowIfNotOnUIThread() или используйте await в JoinableTaskFactory.SwitchToMainThreadAsync().</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
<trans-unit id="VSTHRD010_Title" translate="yes" xml:space="preserve">
<source>Use VS services from UI thread</source>
<target state="translated">Использование служб VS в потоке пользовательского интерфейса</target>
<source>Invoke single-threaded types on Main thread</source>
<target state="needs-review-translation">Использование служб VS в потоке пользовательского интерфейса</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
</trans-unit>
<trans-unit id="VSTHRD100_MessageFormat" translate="yes" xml:space="preserve">
<source>Avoid "async void" methods, because any exceptions not handled by the method will crash the process.</source>
@ -182,6 +185,13 @@ Use AsyncLazy&lt;T&gt; instead.</source>
<source>Assert thread affinity unconditionally</source>
<target state="new">Assert thread affinity unconditionally</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat_NoAssertingMethod" translate="yes" xml:space="preserve">
<source>The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="new">The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</target>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
</group>
</body>
</file>

Просмотреть файл

@ -27,14 +27,17 @@
<target state="translated">Sorunlu zaman uyumlu beklemelerden kaçının</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat" translate="yes" xml:space="preserve">
<source>Visual Studio service "{0}" should be used on main thread explicitly.
Call ThreadHelper.ThrowIfNotOnUIThread() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="translated">"{0}" Visual Studio hizmeti, ana iş parçacığında açık olarak kullanılmalıdır.
<source>The type "{0}" should be used on main thread explicitly.
Call {1}() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="needs-review-translation">"{0}" Visual Studio hizmeti, ana iş parçacığında açık olarak kullanılmalıdır.
ThreadHelper.ThrowIfNotOnUIThread() çağırın veya önce JoinableTaskFactory.SwitchToMainThreadAsync() bekleyin.</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
<trans-unit id="VSTHRD010_Title" translate="yes" xml:space="preserve">
<source>Use VS services from UI thread</source>
<target state="translated">UI iş parçacığından VS hizmetlerini kullanın</target>
<source>Invoke single-threaded types on Main thread</source>
<target state="needs-review-translation">UI iş parçacığından VS hizmetlerini kullanın</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
</trans-unit>
<trans-unit id="VSTHRD100_MessageFormat" translate="yes" xml:space="preserve">
<source>Avoid "async void" methods, because any exceptions not handled by the method will crash the process.</source>
@ -182,6 +185,13 @@ Bunun yerine AsyncLazy&lt;T&gt; kullanın.</target>
<source>Assert thread affinity unconditionally</source>
<target state="new">Assert thread affinity unconditionally</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat_NoAssertingMethod" translate="yes" xml:space="preserve">
<source>The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="new">The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</target>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
</group>
</body>
</file>

Просмотреть файл

@ -27,14 +27,17 @@
<target state="translated">避免有问题的同步等待</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat" translate="yes" xml:space="preserve">
<source>Visual Studio service "{0}" should be used on main thread explicitly.
Call ThreadHelper.ThrowIfNotOnUIThread() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="translated">应对主线程显式使用 Visual Studio 服务“{0}”。
<source>The type "{0}" should be used on main thread explicitly.
Call {1}() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="needs-review-translation">应对主线程显式使用 Visual Studio 服务“{0}”。
首先调用 ThreadHelper.ThrowIfNotOnUIThread() 或等待 JoinableTaskFactory.SwitchToMainThreadAsync()。</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
<trans-unit id="VSTHRD010_Title" translate="yes" xml:space="preserve">
<source>Use VS services from UI thread</source>
<target state="translated">使用 UI 线程中的 VS 服务</target>
<source>Invoke single-threaded types on Main thread</source>
<target state="needs-review-translation">使用 UI 线程中的 VS 服务</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
</trans-unit>
<trans-unit id="VSTHRD100_MessageFormat" translate="yes" xml:space="preserve">
<source>Avoid "async void" methods, because any exceptions not handled by the method will crash the process.</source>
@ -182,6 +185,13 @@ Use AsyncLazy&lt;T&gt; instead.</source>
<source>Assert thread affinity unconditionally</source>
<target state="new">Assert thread affinity unconditionally</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat_NoAssertingMethod" translate="yes" xml:space="preserve">
<source>The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="new">The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</target>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
</group>
</body>
</file>

Просмотреть файл

@ -27,14 +27,17 @@
<target state="translated">避免有問題的同步等候</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat" translate="yes" xml:space="preserve">
<source>Visual Studio service "{0}" should be used on main thread explicitly.
Call ThreadHelper.ThrowIfNotOnUIThread() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="translated">Visual Studio 服務 "{0}" 應該明確用在主執行緒。
<source>The type "{0}" should be used on main thread explicitly.
Call {1}() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="needs-review-translation">Visual Studio 服務 "{0}" 應該明確用在主執行緒。
請先呼叫 ThreadHelper.ThrowIfNotOnUIThread() 或 await JoinableTaskFactory.SwitchToMainThreadAsync()。</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
<trans-unit id="VSTHRD010_Title" translate="yes" xml:space="preserve">
<source>Use VS services from UI thread</source>
<target state="translated">從 UI 執行緒使用 VS 服務</target>
<source>Invoke single-threaded types on Main thread</source>
<target state="needs-review-translation">從 UI 執行緒使用 VS 服務</target>
<note from="MultilingualUpdate" annotates="source" priority="2">Please verify the translations accuracy as the source string was updated after it was translated.</note>
</trans-unit>
<trans-unit id="VSTHRD100_MessageFormat" translate="yes" xml:space="preserve">
<source>Avoid "async void" methods, because any exceptions not handled by the method will crash the process.</source>
@ -182,6 +185,13 @@ Use AsyncLazy&lt;T&gt; instead.</source>
<source>Assert thread affinity unconditionally</source>
<target state="new">Assert thread affinity unconditionally</target>
</trans-unit>
<trans-unit id="VSTHRD010_MessageFormat_NoAssertingMethod" translate="yes" xml:space="preserve">
<source>The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</source>
<target state="new">The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</target>
<note from="MultilingualBuild" annotates="source" priority="2">{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</note>
</trans-unit>
</group>
</body>
</file>

Просмотреть файл

@ -144,8 +144,8 @@ namespace Microsoft.VisualStudio.Threading.Analyzers {
}
/// <summary>
/// Looks up a localized string similar to Visual Studio service &quot;{0}&quot; should be used on main thread explicitly.
///Call ThreadHelper.ThrowIfNotOnUIThread() or await JoinableTaskFactory.SwitchToMainThreadAsync() first..
/// Looks up a localized string similar to The type &quot;{0}&quot; should be used on main thread explicitly.
///Call {1}() or await JoinableTaskFactory.SwitchToMainThreadAsync() first..
/// </summary>
internal static string VSTHRD010_MessageFormat {
get {
@ -154,7 +154,17 @@ namespace Microsoft.VisualStudio.Threading.Analyzers {
}
/// <summary>
/// Looks up a localized string similar to Use VS services from UI thread.
/// Looks up a localized string similar to The type &quot;{0}&quot; should be used on main thread explicitly.
///Await JoinableTaskFactory.SwitchToMainThreadAsync() first..
/// </summary>
internal static string VSTHRD010_MessageFormat_NoAssertingMethod {
get {
return ResourceManager.GetString("VSTHRD010_MessageFormat_NoAssertingMethod", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invoke single-threaded types on Main thread.
/// </summary>
internal static string VSTHRD010_Title {
get {
@ -199,24 +209,6 @@ namespace Microsoft.VisualStudio.Threading.Analyzers {
}
}
/// <summary>
/// Looks up a localized string similar to Thread affinity checks should be unconditional..
/// </summary>
internal static string VSTHRD108_MessageFormat {
get {
return ResourceManager.GetString("VSTHRD108_MessageFormat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Assert thread affinity unconditionally.
/// </summary>
internal static string VSTHRD108_Title {
get {
return ResourceManager.GetString("VSTHRD108_Title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Change return type to Task.
/// </summary>
@ -388,6 +380,24 @@ namespace Microsoft.VisualStudio.Threading.Analyzers {
}
}
/// <summary>
/// Looks up a localized string similar to Thread affinity checks should be unconditional..
/// </summary>
internal static string VSTHRD108_MessageFormat {
get {
return ResourceManager.GetString("VSTHRD108_MessageFormat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Assert thread affinity unconditionally.
/// </summary>
internal static string VSTHRD108_Title {
get {
return ResourceManager.GetString("VSTHRD108_Title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Rename to {0}.
/// </summary>

Просмотреть файл

@ -31,6 +31,7 @@
<data name="VSTHRD010_MessageFormat" xml:space="preserve">
<value>Službu Visual Studio {0} je třeba používat explicitně v hlavním vlákně.
Nejprve zavolejte ThreadHelper.ThrowIfNotOnUIThread() nebo počkejte na JoinableTaskFactory.SwitchToMainThreadAsync().</value>
<comment>{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</comment>
</data>
<data name="VSTHRD010_Title" xml:space="preserve">
<value>Použití služeb VS z vlákna uživatelského rozhraní</value>

Просмотреть файл

@ -31,6 +31,7 @@
<data name="VSTHRD010_MessageFormat" xml:space="preserve">
<value>Der Visual Studio-Dienst "{0}" sollte explizit im Hauptthread verwendet werden.
Rufen Sie "ThreadHelper.ThrowIfNotOnUIThread()" auf, oder warten Sie zuerst auf "JoinableTaskFactory.SwitchToMainThreadAsync()".</value>
<comment>{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</comment>
</data>
<data name="VSTHRD010_Title" xml:space="preserve">
<value>VS-Dienste aus dem UI-Thread verwenden</value>

Просмотреть файл

@ -31,6 +31,7 @@
<data name="VSTHRD010_MessageFormat" xml:space="preserve">
<value>El servicio "{0}" de Visual Studio debe usarse explícitamente en el subproceso principal.
Llame a ThreadHelper.ThrowIfNotOnUIThread() o el elemento await JoinableTaskFactory.SwitchToMainThreadAsync() en primer lugar.</value>
<comment>{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</comment>
</data>
<data name="VSTHRD010_Title" xml:space="preserve">
<value>Use servicios de VS desde el subproceso de IU</value>

Просмотреть файл

@ -31,6 +31,7 @@
<data name="VSTHRD010_MessageFormat" xml:space="preserve">
<value>Le service Visual Studio "{0}"doit être utilisé sur le thread principal de manière explicite.
Appelez ThreadHelper.ThrowIfNotOnUIThread() ou attendez d'abord JoinableTaskFactory.SwitchToMainThreadAsync().</value>
<comment>{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</comment>
</data>
<data name="VSTHRD010_Title" xml:space="preserve">
<value>Utiliser les services VS à partir du thread dinterface utilisateur</value>

Просмотреть файл

@ -31,6 +31,7 @@
<data name="VSTHRD010_MessageFormat" xml:space="preserve">
<value>Il servizio "{0}" di Visual Studio non deve essere usato sul thread principale in modo esplicito.
Chiamare prima ThreadHelper.ThrowIfNotOnUIThread() o await JoinableTaskFactory.SwitchToMainThreadAsync().</value>
<comment>{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</comment>
</data>
<data name="VSTHRD010_Title" xml:space="preserve">
<value>Usa i servizi di Visual Studio dal thread dell'interfaccia utente</value>

Просмотреть файл

@ -31,6 +31,7 @@
<data name="VSTHRD010_MessageFormat" xml:space="preserve">
<value>Visual Studio サービス "{0}" は、明示的にメイン スレッドで使用する必要があります。
ThreadHelper.ThrowIfNotOnUIThread() を呼び出すか、まず JoinableTaskFactory.SwitchToMainThreadAsync() を待機してください。</value>
<comment>{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</comment>
</data>
<data name="VSTHRD010_Title" xml:space="preserve">
<value>UI スレッドから VS サービスを使用する</value>

Просмотреть файл

@ -31,6 +31,7 @@
<data name="VSTHRD010_MessageFormat" xml:space="preserve">
<value>주 스레드에서 Visual Studio 서비스 "{0}"을(를) 명시적으로 사용해야 합니다.
ThreadHelper.ThrowIfNotOnUIThread()를 호출하거나, 우선 JoinableTaskFactory.SwitchToMainThreadAsync()를 대기합니다.</value>
<comment>{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</comment>
</data>
<data name="VSTHRD010_Title" xml:space="preserve">
<value>UI 스레드의 VS 서비스를 사용합니다.</value>

Просмотреть файл

@ -31,6 +31,7 @@
<data name="VSTHRD010_MessageFormat" xml:space="preserve">
<value>Usługa programu Visual Studio „{0}” powinna być używana w wątku głównym w sposób jawny.
Najpierw wywołaj metodę ThreadHelper.ThrowIfNotOnUIThread() lub oczekuj na metodę JoinableTaskFactory.SwitchToMainThreadAsync().</value>
<comment>{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</comment>
</data>
<data name="VSTHRD010_Title" xml:space="preserve">
<value>Używaj usług programu VS z wątku interfejsu użytkownika</value>

Просмотреть файл

@ -31,6 +31,7 @@
<data name="VSTHRD010_MessageFormat" xml:space="preserve">
<value>O serviço do Visual Studio "{0}" deve ser usado em um thread principal explicitamente.
Chame ThreadHelper.ThrowIfNotOnUIThread() ou espere primeiro pelo JoinableTaskFactory.SwitchToMainThreadAsync().</value>
<comment>{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</comment>
</data>
<data name="VSTHRD010_Title" xml:space="preserve">
<value>Use serviços do VS do thread de interface do usuário</value>

Просмотреть файл

@ -134,11 +134,12 @@
<value>Avoid problematic synchronous waits</value>
</data>
<data name="VSTHRD010_MessageFormat" xml:space="preserve">
<value>Visual Studio service "{0}" should be used on main thread explicitly.
Call ThreadHelper.ThrowIfNotOnUIThread() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</value>
<value>The type "{0}" should be used on main thread explicitly.
Call {1}() or await JoinableTaskFactory.SwitchToMainThreadAsync() first.</value>
<comment>{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</comment>
</data>
<data name="VSTHRD010_Title" xml:space="preserve">
<value>Use VS services from UI thread</value>
<value>Invoke single-threaded types on Main thread</value>
</data>
<data name="VSTHRD100_CodeFix_Title" xml:space="preserve">
<value>Change return type to Task</value>
@ -251,4 +252,9 @@ Use AsyncLazy&lt;T&gt; instead.</value>
<data name="VSTHRD108_Title" xml:space="preserve">
<value>Assert thread affinity unconditionally</value>
</data>
<data name="VSTHRD010_MessageFormat_NoAssertingMethod" xml:space="preserve">
<value>The type "{0}" should be used on main thread explicitly.
Await JoinableTaskFactory.SwitchToMainThreadAsync() first.</value>
<comment>{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</comment>
</data>
</root>

Просмотреть файл

@ -31,6 +31,7 @@
<data name="VSTHRD010_MessageFormat" xml:space="preserve">
<value>Службу Visual Studio "{0}" следует явно использовать в основном потоке.
Сначала вызовите ThreadHelper.ThrowIfNotOnUIThread() или используйте await в JoinableTaskFactory.SwitchToMainThreadAsync().</value>
<comment>{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</comment>
</data>
<data name="VSTHRD010_Title" xml:space="preserve">
<value>Использование служб VS в потоке пользовательского интерфейса</value>

Просмотреть файл

@ -31,6 +31,7 @@
<data name="VSTHRD010_MessageFormat" xml:space="preserve">
<value>"{0}" Visual Studio hizmeti, ana iş parçacığında açık olarak kullanılmalıdır.
ThreadHelper.ThrowIfNotOnUIThread() çağırın veya önce JoinableTaskFactory.SwitchToMainThreadAsync() bekleyin.</value>
<comment>{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</comment>
</data>
<data name="VSTHRD010_Title" xml:space="preserve">
<value>UI iş parçacığından VS hizmetlerini kullanın</value>

Просмотреть файл

@ -31,6 +31,7 @@
<data name="VSTHRD010_MessageFormat" xml:space="preserve">
<value>应对主线程显式使用 Visual Studio 服务“{0}”。
首先调用 ThreadHelper.ThrowIfNotOnUIThread() 或等待 JoinableTaskFactory.SwitchToMainThreadAsync()。</value>
<comment>{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</comment>
</data>
<data name="VSTHRD010_Title" xml:space="preserve">
<value>使用 UI 线程中的 VS 服务</value>

Просмотреть файл

@ -31,6 +31,7 @@
<data name="VSTHRD010_MessageFormat" xml:space="preserve">
<value>Visual Studio 服務 "{0}" 應該明確用在主執行緒。
請先呼叫 ThreadHelper.ThrowIfNotOnUIThread() 或 await JoinableTaskFactory.SwitchToMainThreadAsync()。</value>
<comment>{0} is a type name and {1} is the name of a method that throws if not called from the main thread.</comment>
</data>
<data name="VSTHRD010_Title" xml:space="preserve">
<value>從 UI 執行緒使用 VS 服務</value>

Просмотреть файл

@ -43,7 +43,7 @@
/// sln.SetProperty(); /* Good */
/// </remarks>
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class VSTHRD010VsServiceUsageAnalyzer : DiagnosticAnalyzer
public class VSTHRD010MainThreadUsageAnalyzer : DiagnosticAnalyzer
{
public const string Id = "VSTHRD010";
@ -56,6 +56,15 @@
defaultSeverity: DiagnosticSeverity.Warning,
isEnabledByDefault: true);
internal static readonly DiagnosticDescriptor DescriptorNoAssertingMethod = new DiagnosticDescriptor(
id: Id,
title: Strings.VSTHRD010_Title,
messageFormat: Strings.VSTHRD010_MessageFormat_NoAssertingMethod,
helpLinkUri: Utils.GetHelpLink(Id),
category: "Usage",
defaultSeverity: DiagnosticSeverity.Warning,
isEnabledByDefault: true);
private enum ThreadingContext
{
/// <summary>
@ -211,7 +220,9 @@
if (threadingContext != ThreadingContext.MainThread)
{
Location location = (focusDiagnosticOn ?? context.Node).GetLocation();
context.ReportDiagnostic(Diagnostic.Create(Descriptor, location, type.Name));
string exampleAssertingMethod = this.MainThreadAssertingMethods.FirstOrDefault();
var descriptor = exampleAssertingMethod != null ? Descriptor : DescriptorNoAssertingMethod;
context.ReportDiagnostic(Diagnostic.Create(descriptor, location, type.Name, descriptor));
return true;
}
}