зеркало из https://github.com/microsoft/testfx.git
Родитель
09243e848c
Коммит
7211748f6f
|
@ -220,6 +220,15 @@ dotnet_diagnostic.SA1615.severity = none
|
|||
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3687
|
||||
dotnet_diagnostic.SA1010.severity = none
|
||||
|
||||
# VSTHRD002 Avoid problematic synchronous waits
|
||||
dotnet_diagnostic.VSTHRD002.severity = none
|
||||
|
||||
# VSTHRD003: Avoid awaiting foreign Tasks
|
||||
dotnet_diagnostic.VSTHRD003.severity = none
|
||||
|
||||
# VSTHRD105: Avoid method overloads that assume TaskScheduler.Current
|
||||
dotnet_diagnostic.VSTHRD105.severity = none
|
||||
|
||||
#### Naming styles ####
|
||||
|
||||
## Naming rules (define naming rule using dotnet_naming_rule.<rule_name>.<option>)
|
||||
|
|
|
@ -20,6 +20,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFramework", "src\TestFr
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{A9596292-7E67-4566-9096-143DDAA4E8D8}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
test\.editorconfig = test\.editorconfig
|
||||
test\Directory.Build.targets = test\Directory.Build.targets
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
|
|
@ -18,5 +18,7 @@
|
|||
<PackageReference Include="StyleCop.Analyzers"
|
||||
Version="$(StyleCopAnalyzersVersion)"
|
||||
PrivateAsset="all" />
|
||||
|
||||
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="$(MicrosoftVisualStudioThreadingAnalyzersVersion)" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -25,5 +25,6 @@
|
|||
<RoslynPublicApiAnalyzersVersion>3.3.4</RoslynPublicApiAnalyzersVersion>
|
||||
<StrongNamerVersion>0.2.5</StrongNamerVersion>
|
||||
<StyleCopAnalyzersVersion>1.2.0-beta.507</StyleCopAnalyzersVersion>
|
||||
<MicrosoftVisualStudioThreadingAnalyzersVersion>17.7.30</MicrosoftVisualStudioThreadingAnalyzersVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
|
@ -47,7 +47,7 @@ internal static class CountDownEventExtensions
|
|||
// signaled, stop future execution of the callback method
|
||||
// by unregistering the WaitHandle.
|
||||
registeredHandle?.Unregister(null);
|
||||
tokenRegistration.Dispose();
|
||||
await DisposeHelper.DisposeAsync(tokenRegistration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -262,7 +262,11 @@ internal sealed partial class ServerTestHost : CommonTestHost, IServerTestHost,
|
|||
if (!_serverClosingTokenSource.IsCancellationRequested)
|
||||
{
|
||||
await _logger.LogInformationAsync("Server requested to shutdown");
|
||||
#if NET8_0_OR_GREATER
|
||||
await _serverClosingTokenSource.CancelAsync();
|
||||
#else
|
||||
_serverClosingTokenSource.Cancel();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Signal the exit call
|
||||
|
@ -271,7 +275,11 @@ internal sealed partial class ServerTestHost : CommonTestHost, IServerTestHost,
|
|||
// If there're no in-flight request we can close the server
|
||||
if (_clientToServerRequests.IsEmpty)
|
||||
{
|
||||
#if NET8_0_OR_GREATER
|
||||
await _stopMessageHandler.CancelAsync();
|
||||
#else
|
||||
_stopMessageHandler.Cancel();
|
||||
#endif
|
||||
}
|
||||
|
||||
continue;
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
#if NETCOREAPP
|
||||
using Microsoft.Testing.Platform.Helpers;
|
||||
#endif
|
||||
using Microsoft.Testing.Platform.IPC;
|
||||
using Microsoft.Testing.Platform.IPC.Models;
|
||||
|
||||
|
@ -40,7 +38,7 @@ internal class TestHostControlledHost : ITestHost, IDisposable
|
|||
}
|
||||
finally
|
||||
{
|
||||
_namedPipeClient.Dispose();
|
||||
await DisposeHelper.DisposeAsync(_namedPipeClient);
|
||||
}
|
||||
|
||||
return exitCode;
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
###############################
|
||||
# Core EditorConfig Options #
|
||||
###############################
|
||||
|
||||
root = false
|
||||
|
||||
[*.{cs,vb}]
|
||||
|
||||
#### .NET Coding Conventions ####
|
||||
|
||||
# VSTHRD200: Use "Async" suffix for async methods
|
||||
dotnet_diagnostic.VSTHRD200.severity = none
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -208,6 +209,7 @@ internal abstract class DummyTestClass
|
|||
|
||||
public abstract void AbstractTestMethod();
|
||||
|
||||
[SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "Done on purpose")]
|
||||
public async void AsyncMethodWithVoidReturnType()
|
||||
{
|
||||
await Task.FromResult(true);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -439,6 +440,7 @@ public class MethodInfoExtensionsTests : TestContainer
|
|||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
[SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "Done on purpose")]
|
||||
public static async void PublicStaticAsyncVoidMethodWithTC(UTFExtension.TestContext tc)
|
||||
{
|
||||
await Task.FromResult(true).ConfigureAwait(false);
|
||||
|
@ -454,6 +456,7 @@ public class MethodInfoExtensionsTests : TestContainer
|
|||
await Task.FromResult(true).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "Done on purpose")]
|
||||
public static async void PublicStaticAsyncVoidMethod()
|
||||
{
|
||||
await Task.FromResult(true).ConfigureAwait(false);
|
||||
|
@ -488,6 +491,7 @@ public class MethodInfoExtensionsTests : TestContainer
|
|||
await Task.FromResult(true).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "Done on purpose")]
|
||||
public async void PublicAsyncVoidMethod()
|
||||
{
|
||||
await Task.FromResult(true).ConfigureAwait(false);
|
||||
|
|
|
@ -85,7 +85,7 @@ internal sealed class AdapterToTestPlatform : ITestDiscoverer, ITestExecutor
|
|||
out var testClassInstance))
|
||||
{
|
||||
// Only run test if test setup was successful.
|
||||
TryRunTest(testMethod, testClassInstance, testCase.DisplayName, testResult, frameworkHandle)
|
||||
TryRunTestAsync(testMethod, testClassInstance, testCase.DisplayName, testResult, frameworkHandle)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ internal sealed class AdapterToTestPlatform : ITestDiscoverer, ITestExecutor
|
|||
}
|
||||
}
|
||||
|
||||
private static async Task<bool> TryRunTest(MethodInfo testMethod, object testClassInstance, string testDisplayName,
|
||||
private static async Task<bool> TryRunTestAsync(MethodInfo testMethod, object testClassInstance, string testDisplayName,
|
||||
TestResult testResult, IMessageLogger? logger)
|
||||
{
|
||||
try
|
||||
|
|
Загрузка…
Ссылка в новой задаче