Skip to content

Commit 7811d43

Browse files
committed
Use nullable regions for code that has introduced nullable
1 parent 0a29b6c commit 7811d43

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Kerberos.NET/Cache/FileHandle.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed to The .NET Foundation under one or more agreements.
33
// The .NET Foundation licenses this file to you under the MIT license.
44
// -----------------------------------------------------------------------
5-
#nullable enable
65

76
using System;
87
using System.IO;
@@ -21,8 +20,9 @@ internal class FileHandle : IDisposable
2120
private readonly FileMode mode;
2221
private readonly FileAccess access;
2322
private readonly FileShare share;
23+
#nullable enable
2424
private static readonly MethodInfo? SetUnixFileMode = TryGetSetUnixFileMode();
25-
25+
#nullable disable
2626
private static readonly TimeSpan LockWaitTimeout = TimeSpan.FromMilliseconds(5000);
2727

2828
public FileHandle(string file, FileMode mode, FileAccess access, FileShare share)
@@ -79,6 +79,7 @@ private static string GetObjectName(string file, string type)
7979
.Replace(Path.VolumeSeparatorChar, '_');
8080
}
8181

82+
#nullable enable
8283
private static MethodInfo? TryGetSetUnixFileMode()
8384
{
8485
MethodInfo? mi = null;
@@ -91,11 +92,15 @@ private static string GetObjectName(string file, string type)
9192
{
9293
mi = typeof(File).GetMethod("SetUnixFileMode", new Type[] { typeof(SafeFileHandle), Type.GetType("System.IO.UnixFileMode") });
9394
}
94-
catch { }
95+
catch
96+
{
97+
// ignored
98+
}
9599
}
96100

97101
return mi;
98102
}
103+
#nullable disable
99104

100105
private class FileLock : IDisposable
101106
{

0 commit comments

Comments
 (0)