Skip to content

Commit 121ee76

Browse files
committed
add Microsoft.VisualStudio.Threading.Analyzers
1 parent d9b0218 commit 121ee76

File tree

9 files changed

+81
-3
lines changed

9 files changed

+81
-3
lines changed

Directory.Build.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@
2020
<Compile Include="$(MSBuildThisFileDirectory)/Global.cs" Link="Global.cs" />
2121
</ItemGroup>
2222

23+
<ItemGroup>
24+
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.14.15" PrivateAssets="All" />
25+
</ItemGroup>
26+
2327
</Project>

SimpleExec/Command.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,10 @@ private static async Task RunAsync(
429429
await Task.WhenAll(runProcess, readOutput, readError).ConfigureAwait(false);
430430

431431
#pragma warning disable CA1849 // Call async methods when in an async method
432+
#pragma warning disable VSTHRD103 // Result synchronously blocks. Use await instead.
432433
var output = readOutput.Result;
433434
var error = readError.Result;
435+
#pragma warning restore VSTHRD103
434436
#pragma warning restore CA1849
435437

436438
return (handleExitCode?.Invoke(process.ExitCode) ?? false) || process.ExitCode == 0

SimpleExec/packages.lock.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
"resolved": "4.1.5",
2121
"contentHash": "i5z+cNu/cOcdO0AgFB8aXk8w6In2H+haaDfSgd9ImvQIK+rSHavHZIogVoAZLL8jLwYx4bAcs5b7EyuMMG4mQQ=="
2222
},
23+
"Microsoft.VisualStudio.Threading.Analyzers": {
24+
"type": "Direct",
25+
"requested": "[17.14.15, )",
26+
"resolved": "17.14.15",
27+
"contentHash": "mXQPJsbuUD2ydq4/ffd8h8tSOFCXec+2xJOVNCvXjuMOq/+5EKHq3D2m2MC2+nUaXeFMSt66VS/J4HdKBixgcw=="
28+
},
2329
"MinVer": {
2430
"type": "Direct",
2531
"requested": "[8.0.0-alpha.1, )",
@@ -46,6 +52,12 @@
4652
"resolved": "4.1.5",
4753
"contentHash": "i5z+cNu/cOcdO0AgFB8aXk8w6In2H+haaDfSgd9ImvQIK+rSHavHZIogVoAZLL8jLwYx4bAcs5b7EyuMMG4mQQ=="
4854
},
55+
"Microsoft.VisualStudio.Threading.Analyzers": {
56+
"type": "Direct",
57+
"requested": "[17.14.15, )",
58+
"resolved": "17.14.15",
59+
"contentHash": "mXQPJsbuUD2ydq4/ffd8h8tSOFCXec+2xJOVNCvXjuMOq/+5EKHq3D2m2MC2+nUaXeFMSt66VS/J4HdKBixgcw=="
60+
},
4961
"MinVer": {
5062
"type": "Direct",
5163
"requested": "[8.0.0-alpha.1, )",
@@ -72,6 +84,12 @@
7284
"resolved": "4.1.5",
7385
"contentHash": "i5z+cNu/cOcdO0AgFB8aXk8w6In2H+haaDfSgd9ImvQIK+rSHavHZIogVoAZLL8jLwYx4bAcs5b7EyuMMG4mQQ=="
7486
},
87+
"Microsoft.VisualStudio.Threading.Analyzers": {
88+
"type": "Direct",
89+
"requested": "[17.14.15, )",
90+
"resolved": "17.14.15",
91+
"contentHash": "mXQPJsbuUD2ydq4/ffd8h8tSOFCXec+2xJOVNCvXjuMOq/+5EKHq3D2m2MC2+nUaXeFMSt66VS/J4HdKBixgcw=="
92+
},
7593
"MinVer": {
7694
"type": "Direct",
7795
"requested": "[8.0.0-alpha.1, )",
Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
11
{
22
"version": 1,
33
"dependencies": {
4-
"net10.0": {},
5-
"net8.0": {},
6-
"net9.0": {}
4+
"net10.0": {
5+
"Microsoft.VisualStudio.Threading.Analyzers": {
6+
"type": "Direct",
7+
"requested": "[17.14.15, )",
8+
"resolved": "17.14.15",
9+
"contentHash": "mXQPJsbuUD2ydq4/ffd8h8tSOFCXec+2xJOVNCvXjuMOq/+5EKHq3D2m2MC2+nUaXeFMSt66VS/J4HdKBixgcw=="
10+
}
11+
},
12+
"net8.0": {
13+
"Microsoft.VisualStudio.Threading.Analyzers": {
14+
"type": "Direct",
15+
"requested": "[17.14.15, )",
16+
"resolved": "17.14.15",
17+
"contentHash": "mXQPJsbuUD2ydq4/ffd8h8tSOFCXec+2xJOVNCvXjuMOq/+5EKHq3D2m2MC2+nUaXeFMSt66VS/J4HdKBixgcw=="
18+
}
19+
},
20+
"net9.0": {
21+
"Microsoft.VisualStudio.Threading.Analyzers": {
22+
"type": "Direct",
23+
"requested": "[17.14.15, )",
24+
"resolved": "17.14.15",
25+
"contentHash": "mXQPJsbuUD2ydq4/ffd8h8tSOFCXec+2xJOVNCvXjuMOq/+5EKHq3D2m2MC2+nUaXeFMSt66VS/J4HdKBixgcw=="
26+
}
27+
}
728
}
829
}

SimpleExecTests/.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22

33
# CA2007: Consider calling ConfigureAwait on the awaited task
44
dotnet_diagnostic.CA2007.severity = none
5+
6+
# VSTHRD111: Add .ConfigureAwait(bool) to your await expression
7+
dotnet_diagnostic.VSTHRD111.severity = none

SimpleExecTests/CancellingCommands.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ public static async Task RunningACommandAsyncWithCreateNoWindow(bool createNoWin
7575
await cts.CancelAsync();
7676

7777
// assert
78+
#pragma warning disable VSTHRD003 // Avoid awaiting or returning a Task representing work that was not started within your context as that can lead to deadlocks.
7879
var exception = await Record.ExceptionAsync(() => command);
80+
#pragma warning restore VSTHRD003
81+
7982
Assert.Equal(ct, Assert.IsType<TaskCanceledException>(exception).CancellationToken);
8083
}
8184
}

SimpleExecTests/packages.lock.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
"resolved": "2.0.2",
1515
"contentHash": "43NCOTEENtdc9fmlzX9KHQR14AZEYek5r4jOJlWPhTyV1+aYAQYl4x773nYXU5TKxV6+rMuniJ7wcj9C9qrP1A=="
1616
},
17+
"Microsoft.VisualStudio.Threading.Analyzers": {
18+
"type": "Direct",
19+
"requested": "[17.14.15, )",
20+
"resolved": "17.14.15",
21+
"contentHash": "mXQPJsbuUD2ydq4/ffd8h8tSOFCXec+2xJOVNCvXjuMOq/+5EKHq3D2m2MC2+nUaXeFMSt66VS/J4HdKBixgcw=="
22+
},
1723
"PublicApiGenerator": {
1824
"type": "Direct",
1925
"requested": "[11.5.4, )",
@@ -209,6 +215,12 @@
209215
"resolved": "2.0.2",
210216
"contentHash": "43NCOTEENtdc9fmlzX9KHQR14AZEYek5r4jOJlWPhTyV1+aYAQYl4x773nYXU5TKxV6+rMuniJ7wcj9C9qrP1A=="
211217
},
218+
"Microsoft.VisualStudio.Threading.Analyzers": {
219+
"type": "Direct",
220+
"requested": "[17.14.15, )",
221+
"resolved": "17.14.15",
222+
"contentHash": "mXQPJsbuUD2ydq4/ffd8h8tSOFCXec+2xJOVNCvXjuMOq/+5EKHq3D2m2MC2+nUaXeFMSt66VS/J4HdKBixgcw=="
223+
},
212224
"PublicApiGenerator": {
213225
"type": "Direct",
214226
"requested": "[11.5.4, )",
@@ -404,6 +416,12 @@
404416
"resolved": "2.0.2",
405417
"contentHash": "43NCOTEENtdc9fmlzX9KHQR14AZEYek5r4jOJlWPhTyV1+aYAQYl4x773nYXU5TKxV6+rMuniJ7wcj9C9qrP1A=="
406418
},
419+
"Microsoft.VisualStudio.Threading.Analyzers": {
420+
"type": "Direct",
421+
"requested": "[17.14.15, )",
422+
"resolved": "17.14.15",
423+
"contentHash": "mXQPJsbuUD2ydq4/ffd8h8tSOFCXec+2xJOVNCvXjuMOq/+5EKHq3D2m2MC2+nUaXeFMSt66VS/J4HdKBixgcw=="
424+
},
407425
"PublicApiGenerator": {
408426
"type": "Direct",
409427
"requested": "[11.5.4, )",

targets/.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22

33
# CA2007: Consider calling ConfigureAwait on the awaited task
44
dotnet_diagnostic.CA2007.severity = none
5+
6+
# VSTHRD111: Add .ConfigureAwait(bool) to your await expression
7+
dotnet_diagnostic.VSTHRD111.severity = none

targets/packages.lock.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
"requested": "[6.1.0, )",
88
"resolved": "6.1.0",
99
"contentHash": "fltnAJDe0BEX5eymXGUq+il2rSUA0pHqUonNDRH2TrvRu8SkU17mYG0IVpdmG2ibtfhdjNrv4CuTCxHOwcozCA=="
10+
},
11+
"Microsoft.VisualStudio.Threading.Analyzers": {
12+
"type": "Direct",
13+
"requested": "[17.14.15, )",
14+
"resolved": "17.14.15",
15+
"contentHash": "mXQPJsbuUD2ydq4/ffd8h8tSOFCXec+2xJOVNCvXjuMOq/+5EKHq3D2m2MC2+nUaXeFMSt66VS/J4HdKBixgcw=="
1016
}
1117
}
1218
}

0 commit comments

Comments
 (0)