Skip to content

Commit

Permalink
Fix: VS 2022 errors (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
Asaf Agami authored Aug 29, 2022
1 parent d50f65e commit 59be2a3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Snyk Changelog

## [1.1.27]

### Fixed
- Bug in VS2022 when loading the extension

## [1.1.26]

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@
<PackageReference Include="MarkdownSharp">
<Version>2.0.5</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.1.32210.191" ExcludeAssets="runtime">
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.3.32804.24" ExcludeAssets="runtime">
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.1.4054">
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.3.2094">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
29 changes: 17 additions & 12 deletions Snyk.VisualStudio.Extension.Shared/Service/SnykTasksService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class SnykTasksService

private ISnykServiceProvider serviceProvider;

private object cancelTasksLock;

/// <summary>
/// Initializes a new instance of the <see cref="SnykTasksService"/> class.
/// </summary>
Expand Down Expand Up @@ -168,21 +170,24 @@ public static async Task InitializeAsync(ISnykServiceProvider serviceProvider)
/// </summary>
public void CancelTasks()
{
try
lock (this.cancelTasksLock)
{
this.isOssScanning = false;
this.isSnykCodeScanning = false;
this.isCliDownloading = false;
try
{
this.isOssScanning = false;
this.isSnykCodeScanning = false;
this.isCliDownloading = false;

this.CancelTask(ref this.ossScanTokenSource);
this.CancelTask(ref this.snykCodeScanTokenSource);
this.CancelTask(ref this.downloadCliTokenSource);
this.CancelTask(ref this.ossScanTokenSource);
this.CancelTask(ref this.snykCodeScanTokenSource);
this.CancelTask(ref this.downloadCliTokenSource);

this.serviceProvider.OssService.StopScan();
}
catch (Exception ex)
{
Logger.Error(ex, "Error on cancel tasks");
this.serviceProvider.OssService.StopScan();
}
catch (Exception ex)
{
Logger.Error(ex, "Error on cancel tasks");
}
}
}

Expand Down

0 comments on commit 59be2a3

Please sign in to comment.