Skip to content

Commit 55e41ba

Browse files
authored
fix Win32Exception Access is denied (#544)
#542
1 parent 15074ef commit 55e41ba

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/DiffEngineTray/GlobalUsings.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Global using directives
2+
3+
global using System.ComponentModel;
4+
global using Microsoft.Win32.SafeHandles;

src/DiffEngineTray/ProcessEx.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using Microsoft.Win32.SafeHandles;
2-
31
static class ProcessEx
42
{
53
[DllImport("kernel32.dll", ExactSpelling = true, SetLastError = true)]
@@ -46,6 +44,11 @@ public static void KillAndDispose(this Process process)
4644
{
4745
// Race condition can cause "No process is associated with this object"
4846
}
47+
catch (Win32Exception)
48+
{
49+
// no permission or already closed
50+
// https://github.com/VerifyTests/DiffEngine/issues/542
51+
}
4952
catch (Exception exception)
5053
{
5154
ExceptionHandler.Handle($"Failed to kill process. Id:{process.Id} Name: {process.MainModule?.FileName}", exception);

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project>
33
<PropertyGroup>
44
<NoWarn>CS1591;CS0649</NoWarn>
5-
<Version>15.5.1</Version>
5+
<Version>15.5.2</Version>
66
<AssemblyVersion>1.0.0</AssemblyVersion>
77
<PackageTags>Testing, Snapshot, Diff, Compare</PackageTags>
88
<Description>Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.</Description>

0 commit comments

Comments
 (0)