Skip to content

Commit 59be2a3

Browse files
author
Asaf Agami
authored
Fix: VS 2022 errors (#208)
1 parent d50f65e commit 59be2a3

3 files changed

Lines changed: 24 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Snyk Changelog
22

3+
## [1.1.27]
4+
5+
### Fixed
6+
- Bug in VS2022 when loading the extension
7+
38
## [1.1.26]
49

510
### Fixed

Snyk.VisualStudio.Extension.2022/Snyk.VisualStudio.Extension.2022.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@
7575
<PackageReference Include="MarkdownSharp">
7676
<Version>2.0.5</Version>
7777
</PackageReference>
78-
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.1.32210.191" ExcludeAssets="runtime">
78+
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.3.32804.24" ExcludeAssets="runtime">
7979
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
8080
</PackageReference>
81-
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.1.4054">
81+
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.3.2094">
8282
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
8383
<PrivateAssets>all</PrivateAssets>
8484
</PackageReference>

Snyk.VisualStudio.Extension.Shared/Service/SnykTasksService.cs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public class SnykTasksService
3838

3939
private ISnykServiceProvider serviceProvider;
4040

41+
private object cancelTasksLock;
42+
4143
/// <summary>
4244
/// Initializes a new instance of the <see cref="SnykTasksService"/> class.
4345
/// </summary>
@@ -168,21 +170,24 @@ public static async Task InitializeAsync(ISnykServiceProvider serviceProvider)
168170
/// </summary>
169171
public void CancelTasks()
170172
{
171-
try
173+
lock (this.cancelTasksLock)
172174
{
173-
this.isOssScanning = false;
174-
this.isSnykCodeScanning = false;
175-
this.isCliDownloading = false;
175+
try
176+
{
177+
this.isOssScanning = false;
178+
this.isSnykCodeScanning = false;
179+
this.isCliDownloading = false;
176180

177-
this.CancelTask(ref this.ossScanTokenSource);
178-
this.CancelTask(ref this.snykCodeScanTokenSource);
179-
this.CancelTask(ref this.downloadCliTokenSource);
181+
this.CancelTask(ref this.ossScanTokenSource);
182+
this.CancelTask(ref this.snykCodeScanTokenSource);
183+
this.CancelTask(ref this.downloadCliTokenSource);
180184

181-
this.serviceProvider.OssService.StopScan();
182-
}
183-
catch (Exception ex)
184-
{
185-
Logger.Error(ex, "Error on cancel tasks");
185+
this.serviceProvider.OssService.StopScan();
186+
}
187+
catch (Exception ex)
188+
{
189+
Logger.Error(ex, "Error on cancel tasks");
190+
}
186191
}
187192
}
188193

0 commit comments

Comments
 (0)