Skip to content

Commit de83a61

Browse files
authored
Merge branch 'main' into remove-redundant-Empty-constructor-and-mark-as-error
2 parents 7f830d5 + b66a5e1 commit de83a61

File tree

53 files changed

+262
-83
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+262
-83
lines changed

dotnet.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
[dotnet.test:runner]
1+
[dotnet.test.runner]
22
name= "Microsoft.Testing.Platform"

eng/Version.Details.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Dependencies>
33
<ToolsetDependencies>
4-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="10.0.0-beta.25204.12">
4+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="10.0.0-beta.25206.1">
55
<Uri>https://github.com/dotnet/arcade</Uri>
6-
<Sha>25bd3926321ea9b6ca66c772e03a76e7a5010227</Sha>
6+
<Sha>37f732fbfa006386f89a16be417278ea4fee375e</Sha>
77
</Dependency>
8-
<Dependency Name="Microsoft.DotNet.Build.Tasks.Templating" Version="10.0.0-beta.25204.12">
8+
<Dependency Name="Microsoft.DotNet.Build.Tasks.Templating" Version="10.0.0-beta.25206.1">
99
<Uri>https://github.com/dotnet/arcade</Uri>
10-
<Sha>25bd3926321ea9b6ca66c772e03a76e7a5010227</Sha>
10+
<Sha>37f732fbfa006386f89a16be417278ea4fee375e</Sha>
1111
</Dependency>
12-
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="10.0.0-beta.25204.12">
12+
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="10.0.0-beta.25206.1">
1313
<Uri>https://github.com/dotnet/arcade</Uri>
14-
<Sha>25bd3926321ea9b6ca66c772e03a76e7a5010227</Sha>
14+
<Sha>37f732fbfa006386f89a16be417278ea4fee375e</Sha>
1515
</Dependency>
1616
<Dependency Name="Microsoft.Testing.Extensions.CodeCoverage" Version="17.15.0-preview.25204.2">
1717
<Uri>https://dev.azure.com/devdiv/DevDiv/_git/vs-code-coverage</Uri>

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
88
</PropertyGroup>
99
<PropertyGroup Label="MSTest prod dependencies - darc updated">
10-
<MicrosoftDotNetBuildTasksTemplatingPackageVersion>10.0.0-beta.25204.12</MicrosoftDotNetBuildTasksTemplatingPackageVersion>
10+
<MicrosoftDotNetBuildTasksTemplatingPackageVersion>10.0.0-beta.25206.1</MicrosoftDotNetBuildTasksTemplatingPackageVersion>
1111
<MicrosoftTestingExtensionsCodeCoverageVersion>17.15.0-preview.25204.2</MicrosoftTestingExtensionsCodeCoverageVersion>
1212
</PropertyGroup>
1313
</Project>

global.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"tools": {
3-
"dotnet": "10.0.100-preview.4.25172.1",
3+
"dotnet": "10.0.100-preview.4.25206.7",
44
"runtimes": {
55
"dotnet": [
66
"3.1.32",
@@ -23,12 +23,12 @@
2323
}
2424
},
2525
"sdk": {
26-
"version": "10.0.100-preview.4.25172.1",
26+
"version": "10.0.100-preview.4.25206.7",
2727
"allowPrerelease": true,
2828
"rollForward": "latestFeature"
2929
},
3030
"msbuild-sdks": {
31-
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25204.12",
31+
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25206.1",
3232
"MSBuild.Sdk.Extras": "3.0.44"
3333
}
3434
}

samples/Playground/DebuggerUtility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ private static extern int NtQueryInformationProcess(
349349
out int returnLength);
350350

351351
[DllImport("ole32.dll")]
352-
private static extern int CreateBindCtx(uint reserved, out IBindCtx ppbc);
352+
private static extern int CreateBindCtx(uint reserved, out IBindCtx? ppbc);
353353
}
354354

355355
#endif

samples/Playground/ServerMode/v1.0.0/TestingPlatformClient.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ public async Task TestsUpdateAsync(Guid runId, TestNodeUpdate[]? changes)
198198
{
199199
responseListener.Complete();
200200
_listeners.TryRemove(runId, out _);
201-
return;
202201
}
203202
else
204203
{

src/Adapter/MSTest.Engine/Engine/ThreadPoolTestNodeRunner.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ public void EnqueueTest(TestNode frameworkTestNode, TestNodeUid? parentTestNodeU
103103
catch (OperationCanceledException ex) when (ex.CancellationToken == _cancellationToken)
104104
{
105105
// We are being cancelled, so we don't need to wait anymore
106-
return;
107106
}
108107
finally
109108
{
@@ -187,10 +186,6 @@ public async Task<Result> WaitAllTestsAsync(CancellationToken cancellationToken)
187186
// If the cancellation token is triggered, we don't want to report the cancellation as a failure
188187
return Result.Ok("Cancelled by user");
189188
}
190-
catch
191-
{
192-
throw;
193-
}
194189
}
195190

196191
public void Dispose()

src/Adapter/MSTest.Engine/TestFramework/TestFramework.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ public async Task<CloseTestSessionResult> CloseTestSessionAsync(CloseTestSession
109109
sessionResult.IsSuccess = false;
110110
return sessionResult;
111111
}
112-
catch
113-
{
114-
throw;
115-
}
116112
}
117113

118114
public async Task ExecuteRequestAsync(ExecuteRequestContext context)

src/Adapter/MSTest.TestAdapter/Extensions/MethodInfoExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ private static void InferGenerics(Type parameterType, Type argumentType, List<(T
224224
// For example, if parameterType is `T[]` and argumentType is `string[]`, we need to infer that `T` is `string`.
225225
// So, we call InferGenerics with `T` and `string`.
226226
InferGenerics(parameterTypeElementType, argumentTypeElementType, result);
227-
return;
228227
}
229228
else if (parameterType.GenericTypeArguments.Length == argumentType.GenericTypeArguments.Length)
230229
{

src/Adapter/MSTest.TestAdapter/Helpers/ReflectHelper.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ internal class ReflectHelper : MarshalByRefObject
2222
private readonly ConcurrentDictionary<ICustomAttributeProvider, Attribute[]> _inheritedAttributeCache = [];
2323
private readonly ConcurrentDictionary<ICustomAttributeProvider, Attribute[]> _nonInheritedAttributeCache = [];
2424

25-
internal /* for tests only, because of Moq */ ReflectHelper()
26-
{
27-
}
28-
2925
public static ReflectHelper Instance => InstanceValue.Value;
3026

3127
/// <summary>

src/Adapter/MSTestAdapter.PlatformServices/Utilities/DeploymentItemUtility.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ private static List<DeploymentItem> GetDeploymentItems(IEnumerable deploymentIte
232232

233233
private static KeyValuePair<string, string>[]? ToKeyValuePairs(IEnumerable<DeploymentItem> deploymentItemList)
234234
{
235-
if (deploymentItemList == null || !deploymentItemList.Any())
235+
if (!deploymentItemList.Any())
236236
{
237237
return null;
238238
}
@@ -252,7 +252,7 @@ private static List<DeploymentItem> GetDeploymentItems(IEnumerable deploymentIte
252252

253253
private static IList<DeploymentItem>? FromKeyValuePairs(KeyValuePair<string, string>[] deploymentItemsData)
254254
{
255-
if (deploymentItemsData == null || deploymentItemsData.Length == 0)
255+
if (deploymentItemsData.Length == 0)
256256
{
257257
return null;
258258
}

src/Analyzers/MSTest.Analyzers/UseProperAssertMethodsAnalyzer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ private static void AnalyzeIsTrueOrIsFalseInvocation(OperationAnalysisContext co
346346
properties: properties.ToImmutable(),
347347
properAssertMethod,
348348
isTrueInvocation ? "IsTrue" : "IsFalse"));
349-
return;
350349
}
351350
}
352351

src/Platform/Microsoft.Testing.Extensions.AzureDevOps/AzureDevOpsReporter.cs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ public async Task ConsumeAsync(IDataProducer dataProducer, IData value, Cancella
102102
await WriteExceptionAsync(timeout.Explanation, timeout.Exception);
103103
break;
104104
}
105-
106-
return;
107105
}
108106

109107
private async Task WriteExceptionAsync(string? explanation, Exception? exception)
@@ -123,21 +121,19 @@ private async Task WriteExceptionAsync(string? explanation, Exception? exception
123121
string stackTrace = exception.StackTrace;
124122
int index = stackTrace.IndexOfAny(NewlineCharacters);
125123
string firstLine = index == -1 ? stackTrace : stackTrace.Substring(0, index);
126-
if (firstLine != null)
124+
125+
(string Code, string File, int LineNumber)? location = GetStackFrameLocation(firstLine);
126+
if (location != null)
127127
{
128-
(string Code, string File, int LineNumber)? location = GetStackFrameLocation(firstLine);
129-
if (location != null)
130-
{
131-
string root = RootFinder.Find();
132-
string file = location.Value.File;
133-
string relativePath = file.StartsWith(root, StringComparison.CurrentCultureIgnoreCase) ? file.Substring(root.Length) : file;
134-
string relativeNormalizedPath = relativePath.Replace('\\', '/');
128+
string root = RootFinder.Find();
129+
string file = location.Value.File;
130+
string relativePath = file.StartsWith(root, StringComparison.CurrentCultureIgnoreCase) ? file.Substring(root.Length) : file;
131+
string relativeNormalizedPath = relativePath.Replace('\\', '/');
135132

136-
string err = AzDoEscaper.Escape(message);
133+
string err = AzDoEscaper.Escape(message);
137134

138-
string line = $"##vso[task.logissue type={_severity};sourcepath={relativeNormalizedPath};linenumber={location.Value.LineNumber};columnnumber=1]{err}";
139-
await _outputDisplay.DisplayAsync(this, new FormattedTextOutputDeviceData(line));
140-
}
135+
string line = $"##vso[task.logissue type={_severity};sourcepath={relativeNormalizedPath};linenumber={location.Value.LineNumber};columnnumber=1]{err}";
136+
await _outputDisplay.DisplayAsync(this, new FormattedTextOutputDeviceData(line));
141137
}
142138
}
143139

src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpProcessLifetimeHandler.cs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,44 @@ public async Task OnTestHostProcessStartedAsync(ITestHostProcessInformation test
191191
await _logger.LogDebugAsync($"Connected to the test host server pipe '{_namedPipeClient.PipeName}'");
192192

193193
// Keep the custom thread to avoid to waste one from thread pool.
194-
_activityIndicatorTask = _task.RunLongRunning(ActivityTimerAsync, "[HangDump] ActivityTimerAsync", cancellation);
194+
_activityIndicatorTask = _task.RunLongRunning(
195+
async () =>
196+
{
197+
try
198+
{
199+
await ActivityTimerAsync();
200+
}
201+
catch (Exception e)
202+
{
203+
await _outputDisplay.DisplayAsync(this, new ErrorMessageOutputDeviceData(string.Format(CultureInfo.InvariantCulture, ExtensionResources.HangDumpFailed, e.ToString(), GetDiskInfo())));
204+
throw;
205+
}
206+
}, "[HangDump] ActivityTimerAsync", cancellation);
195207
}
196208
catch (OperationCanceledException) when (cancellation.IsCancellationRequested)
197209
{
198-
return;
199210
}
200211
}
201212

213+
private static string GetDiskInfo()
214+
{
215+
var builder = new StringBuilder();
216+
DriveInfo[] allDrives = DriveInfo.GetDrives();
217+
218+
foreach (DriveInfo d in allDrives)
219+
{
220+
builder.AppendLine(CultureInfo.InvariantCulture, $"Drive {d.Name}");
221+
if (d.IsReady)
222+
{
223+
builder.AppendLine(CultureInfo.InvariantCulture, $" Available free space: {d.AvailableFreeSpace} bytes");
224+
builder.AppendLine(CultureInfo.InvariantCulture, $" Total free space: {d.TotalFreeSpace} bytes");
225+
builder.AppendLine(CultureInfo.InvariantCulture, $" Total size: {d.TotalSize} bytes");
226+
}
227+
}
228+
229+
return builder.ToString();
230+
}
231+
202232
public async Task OnTestHostProcessExitedAsync(ITestHostProcessInformation testHostProcessInformation, CancellationToken cancellation)
203233
{
204234
if (cancellation.IsCancellationRequested)

src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/ExtensionResources.resx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,15 @@
138138
<data name="HangDumpExtensionDisplayName" xml:space="preserve">
139139
<value>Hang dump</value>
140140
</data>
141+
<data name="HangDumpFailed" xml:space="preserve">
142+
<value>The following exception occurred while taking hang dump:
143+
{0}
144+
145+
Disk info:
146+
{1}</value>
147+
<comment>{0} - the exception that occurred.
148+
{1} - disk info detailing free space</comment>
149+
</data>
141150
<data name="HangDumpFileNameOptionDescription" xml:space="preserve">
142151
<value>Specify the name of the dump file</value>
143152
</data>

src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.cs.xlf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@
3737
<target state="translated">Výpis paměti při zablokování</target>
3838
<note />
3939
</trans-unit>
40+
<trans-unit id="HangDumpFailed">
41+
<source>The following exception occurred while taking hang dump:
42+
{0}
43+
44+
Disk info:
45+
{1}</source>
46+
<target state="new">The following exception occurred while taking hang dump:
47+
{0}
48+
49+
Disk info:
50+
{1}</target>
51+
<note>{0} - the exception that occurred.
52+
{1} - disk info detailing free space</note>
53+
</trans-unit>
4054
<trans-unit id="HangDumpFileNameOptionDescription">
4155
<source>Specify the name of the dump file</source>
4256
<target state="translated">Zadejte název souboru výpisu paměti.</target>

src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.de.xlf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@
3737
<target state="translated">Absturzspeicherabbild</target>
3838
<note />
3939
</trans-unit>
40+
<trans-unit id="HangDumpFailed">
41+
<source>The following exception occurred while taking hang dump:
42+
{0}
43+
44+
Disk info:
45+
{1}</source>
46+
<target state="new">The following exception occurred while taking hang dump:
47+
{0}
48+
49+
Disk info:
50+
{1}</target>
51+
<note>{0} - the exception that occurred.
52+
{1} - disk info detailing free space</note>
53+
</trans-unit>
4054
<trans-unit id="HangDumpFileNameOptionDescription">
4155
<source>Specify the name of the dump file</source>
4256
<target state="translated">Namen der Speicherabbilddatei angeben</target>

src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.es.xlf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@
3737
<target state="translated">Volcado de memoria</target>
3838
<note />
3939
</trans-unit>
40+
<trans-unit id="HangDumpFailed">
41+
<source>The following exception occurred while taking hang dump:
42+
{0}
43+
44+
Disk info:
45+
{1}</source>
46+
<target state="new">The following exception occurred while taking hang dump:
47+
{0}
48+
49+
Disk info:
50+
{1}</target>
51+
<note>{0} - the exception that occurred.
52+
{1} - disk info detailing free space</note>
53+
</trans-unit>
4054
<trans-unit id="HangDumpFileNameOptionDescription">
4155
<source>Specify the name of the dump file</source>
4256
<target state="translated">Especificar el nombre del archivo de volcado</target>

src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.fr.xlf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@
3737
<target state="translated">Blocage de l’image mémoire</target>
3838
<note />
3939
</trans-unit>
40+
<trans-unit id="HangDumpFailed">
41+
<source>The following exception occurred while taking hang dump:
42+
{0}
43+
44+
Disk info:
45+
{1}</source>
46+
<target state="new">The following exception occurred while taking hang dump:
47+
{0}
48+
49+
Disk info:
50+
{1}</target>
51+
<note>{0} - the exception that occurred.
52+
{1} - disk info detailing free space</note>
53+
</trans-unit>
4054
<trans-unit id="HangDumpFileNameOptionDescription">
4155
<source>Specify the name of the dump file</source>
4256
<target state="translated">Spécifier le nom du fichier de vidage</target>

src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.it.xlf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@
3737
<target state="translated">Dump di blocco</target>
3838
<note />
3939
</trans-unit>
40+
<trans-unit id="HangDumpFailed">
41+
<source>The following exception occurred while taking hang dump:
42+
{0}
43+
44+
Disk info:
45+
{1}</source>
46+
<target state="new">The following exception occurred while taking hang dump:
47+
{0}
48+
49+
Disk info:
50+
{1}</target>
51+
<note>{0} - the exception that occurred.
52+
{1} - disk info detailing free space</note>
53+
</trans-unit>
4054
<trans-unit id="HangDumpFileNameOptionDescription">
4155
<source>Specify the name of the dump file</source>
4256
<target state="translated">Specificare il nome del file di dump</target>

src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.ja.xlf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@
3737
<target state="translated">ハング ダンプ</target>
3838
<note />
3939
</trans-unit>
40+
<trans-unit id="HangDumpFailed">
41+
<source>The following exception occurred while taking hang dump:
42+
{0}
43+
44+
Disk info:
45+
{1}</source>
46+
<target state="new">The following exception occurred while taking hang dump:
47+
{0}
48+
49+
Disk info:
50+
{1}</target>
51+
<note>{0} - the exception that occurred.
52+
{1} - disk info detailing free space</note>
53+
</trans-unit>
4054
<trans-unit id="HangDumpFileNameOptionDescription">
4155
<source>Specify the name of the dump file</source>
4256
<target state="translated">ダンプ ファイルの名前を指定する</target>

0 commit comments

Comments
 (0)