Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Win32Exception Access is denied #544

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/DiffEngineTray/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Global using directives

global using System.ComponentModel;
global using Microsoft.Win32.SafeHandles;
7 changes: 5 additions & 2 deletions src/DiffEngineTray/ProcessEx.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using Microsoft.Win32.SafeHandles;

static class ProcessEx
{
[DllImport("kernel32.dll", ExactSpelling = true, SetLastError = true)]
Expand Down Expand Up @@ -46,6 +44,11 @@ public static void KillAndDispose(this Process process)
{
// Race condition can cause "No process is associated with this object"
}
catch (Win32Exception)
{
// no permission or already closed
// https://github.com/VerifyTests/DiffEngine/issues/542
}
catch (Exception exception)
{
ExceptionHandler.Handle($"Failed to kill process. Id:{process.Id} Name: {process.MainModule?.FileName}", exception);
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<PropertyGroup>
<NoWarn>CS1591;CS0649</NoWarn>
<Version>15.5.1</Version>
<Version>15.5.2</Version>
<AssemblyVersion>1.0.0</AssemblyVersion>
<PackageTags>Testing, Snapshot, Diff, Compare</PackageTags>
<Description>Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.</Description>
Expand Down
Loading