Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ internal static partial class Advapi32
{
[LibraryImport(Libraries.Advapi32, EntryPoint = "ClearEventLogW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool ClearEventLog(SafeEventLogReadHandle hEventLog, string lpBackupFileName);
public static partial bool ClearEventLog(SafeEventLogReadHandle hEventLog, string? lpBackupFileName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static partial bool ReportEvent(
short wType,
ushort wcategory,
uint dwEventID,
byte[] lpUserSid,
byte[]? lpUserSid,
short wNumStrings,
int dwDataSize,
IntPtr lpStrings,
Expand Down
22 changes: 11 additions & 11 deletions src/libraries/Common/src/System/Diagnostics/NetFrameworkUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ namespace System.Diagnostics
{
internal static partial class NetFrameworkUtils
{
internal static void EnterMutex(string name, ref Mutex mutex)
internal static void EnterMutex(string name, ref Mutex? mutex)
{
string mutexName = "Global\\" + name;
EnterMutexWithoutGlobal(mutexName, ref mutex);
}

internal static void EnterMutexWithoutGlobal(string mutexName, ref Mutex mutex)
internal static void EnterMutexWithoutGlobal(string mutexName, ref Mutex? mutex)
{
Mutex tmpMutex = new Mutex(false, mutexName, out _);

Expand All @@ -44,7 +44,7 @@ internal static void EnterMutexWithoutGlobal(string mutexName, ref Mutex mutex)
// just to allow us to poll for abort). A limitation of CERs in Whidbey (and part of the problem that put us in this
// position in the first place) is that a CER root in a method will cause the entire method to delay thread aborts. So we
// need to carefully partition the real CER part of out logic in a sub-method (and ensure the jit doesn't inline on us).
private static bool SafeWaitForMutex(Mutex mutexIn, ref Mutex mutexOut)
private static bool SafeWaitForMutex(Mutex mutexIn, ref Mutex? mutexOut)
{
Debug.Assert(mutexOut == null, "You must pass in a null ref Mutex");

Expand All @@ -68,7 +68,7 @@ private static bool SafeWaitForMutex(Mutex mutexIn, ref Mutex mutexOut)
// The portion of SafeWaitForMutex that runs under a CER and thus must not block for a arbitrary period of time.
// This method must not be inlined (to stop the CER accidently spilling into the calling method).
[MethodImplAttribute(MethodImplOptions.NoInlining)]
private static bool SafeWaitForMutexOnce(Mutex mutexIn, ref Mutex mutexOut)
private static bool SafeWaitForMutexOnce(Mutex mutexIn, ref Mutex? mutexOut)
{
bool ret;

Expand Down Expand Up @@ -117,8 +117,8 @@ private static bool SafeWaitForMutexOnce(Mutex mutexIn, ref Mutex mutexOut)
internal static string GetLatestBuildDllDirectory(string machineName)
{
string dllDir = "";
RegistryKey baseKey = null;
RegistryKey complusReg = null;
RegistryKey? baseKey = null;
RegistryKey? complusReg = null;

try
{
Expand All @@ -133,25 +133,25 @@ internal static string GetLatestBuildDllDirectory(string machineName)
complusReg = baseKey.OpenSubKey("SOFTWARE\\Microsoft\\.NETFramework");
if (complusReg != null)
{
string installRoot = (string)complusReg.GetValue("InstallRoot");
string? installRoot = (string?)complusReg.GetValue("InstallRoot");
if (installRoot != null && installRoot != string.Empty)
{
// the "policy" subkey contains a v{major}.{minor} subkey for each version installed. There are also
// some extra subkeys like "standards" and "upgrades" we want to ignore.

// first we figure out what version we are...
string versionPrefix = "v" + Environment.Version.Major + "." + Environment.Version.Minor;
RegistryKey policyKey = complusReg.OpenSubKey("policy");
RegistryKey? policyKey = complusReg.OpenSubKey("policy");

// This is the full version string of the install on the remote machine we want to use (for example "v2.0.50727")
string version = null;
string? version = null;

if (policyKey != null)
{
try
{
// First check to see if there is a version of the runtime with the same minor and major number:
RegistryKey bestKey = policyKey.OpenSubKey(versionPrefix);
RegistryKey? bestKey = policyKey.OpenSubKey(versionPrefix);

if (bestKey != null)
{
Expand Down Expand Up @@ -191,7 +191,7 @@ internal static string GetLatestBuildDllDirectory(string machineName)
continue;
}

RegistryKey k = policyKey.OpenSubKey(majorVersion);
RegistryKey? k = policyKey.OpenSubKey(majorVersion);
if (k == null)
{
// We may be able to use another subkey
Expand Down
Loading
Loading