File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 26
26
<PackageReference Include =" CSharpier.MsBuild" Version =" 0.29.1" PrivateAssets =" all" />
27
27
<PackageReference Include =" Microsoft.TestPlatform.ObjectModel" Version =" 17.11.0" />
28
28
<PackageReference Include =" Microsoft.SourceLink.GitHub" Version =" 8.0.0" PrivateAssets =" all" />
29
- <PackageReference Include =" PolyShim" Version =" 1.12 .0" PrivateAssets =" all" />
29
+ <PackageReference Include =" PolyShim" Version =" 1.13 .0" PrivateAssets =" all" />
30
30
<PackageReference Include =" RazorBlade" Version =" 0.6.0" ExcludeAssets =" compile;runtime" PrivateAssets =" all" />
31
31
</ItemGroup >
32
32
Original file line number Diff line number Diff line change 2
2
using System . IO ;
3
3
using System . Linq ;
4
4
using System . Text ;
5
+ using System . Threading ;
5
6
using GitHubActionsTestLogger . Utils . Extensions ;
6
7
using Microsoft . VisualStudio . TestPlatform . ObjectModel ;
7
8
using Microsoft . VisualStudio . TestPlatform . ObjectModel . Client ;
@@ -11,7 +12,7 @@ namespace GitHubActionsTestLogger;
11
12
12
13
public class TestLoggerContext ( GitHubWorkflow github , TestLoggerOptions options )
13
14
{
14
- private readonly object _lock = new ( ) ;
15
+ private readonly Lock _lock = new ( ) ;
15
16
private TestRunCriteria ? _testRunCriteria ;
16
17
private readonly List < TestResult > _testResults = [ ] ;
17
18
@@ -68,15 +69,15 @@ private string FormatAnnotationMessage(TestResult testResult) =>
68
69
69
70
public void HandleTestRunStart ( TestRunStartEventArgs args )
70
71
{
71
- lock ( _lock )
72
+ using ( _lock . EnterScope ( ) )
72
73
{
73
74
_testRunCriteria = args . TestRunCriteria ;
74
75
}
75
76
}
76
77
77
78
public void HandleTestResult ( TestResultEventArgs args )
78
79
{
79
- lock ( _lock )
80
+ using ( _lock . EnterScope ( ) )
80
81
{
81
82
// Report failed test results to job annotations
82
83
if ( args . Result . Outcome == TestOutcome . Failed )
@@ -96,7 +97,7 @@ public void HandleTestResult(TestResultEventArgs args)
96
97
97
98
public void HandleTestRunComplete ( TestRunCompleteEventArgs args )
98
99
{
99
- lock ( _lock )
100
+ using ( _lock . EnterScope ( ) )
100
101
{
101
102
var testSuite =
102
103
_testRunCriteria ? . Sources ? . FirstOrDefault ( ) ? . Pipe ( Path . GetFileNameWithoutExtension )
You can’t perform that action at this time.
0 commit comments