Skip to content
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: 2 additions & 2 deletions src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ private uint GetCounterInfoPlus(IntPtr hCounter, out UInt32 counterType, out UIn
defaultScale = 0;
timeBase = 0;

Debug.Assert(hCounter != null);
Debug.Assert(hCounter != IntPtr.Zero);

IntPtr pBufferSize = new IntPtr(0);
res = PdhGetCounterInfo(hCounter, false, ref pBufferSize, IntPtr.Zero);
Expand Down Expand Up @@ -1190,7 +1190,7 @@ public uint ReadNextSet(out PerformanceCounterSampleSet nextSet, bool bSkipReadi
UInt64 timeBase = 0;

IntPtr hCounter = _consumerPathToHandleAndInstanceMap[path].hCounter;
Debug.Assert(hCounter != null);
Debug.Assert(hCounter != IntPtr.Zero);

res = GetCounterInfoPlus(hCounter, out counterType, out defaultScale, out timeBase);
if (res != 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,7 @@ internal ImplicitRemotingCodeGenerator(
InvocationInfo invocationInfo)
{
Dbg.Assert(remoteRunspaceInfo != null, "Caller should validate remoteRunspaceInfo != null");
Dbg.Assert(moduleGuid != null, "Caller should validate moduleGuid != null");
Dbg.Assert(moduleGuid != Guid.Empty, "Caller should validate moduleGuid is not empty");
Dbg.Assert(invocationInfo != null, "Caller should validate invocationInfo != null");

_remoteRunspaceInfo = remoteRunspaceInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,6 @@ private void Dispose(bool isDisposingNotFinalizing)
if (!_isDisposed)
{
#if !UNIX
Dbg.Assert(breakHandlerGcHandle != null, "break handler should be set");
ConsoleControl.RemoveBreakHandler();
if (breakHandlerGcHandle.IsAllocated)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ internal void GenerateRow(string[] values, LineOutput lo, bool multiLine, ReadOn
int cols = _si.columnInfo.Length;
Span<int> currentAlignment = cols <= OutCommandInner.StackAllocThreshold ? stackalloc int[cols] : new int[cols];

if (alignment == null)
if (alignment.IsEmpty)
{
for (int i = 0; i < currentAlignment.Length; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ internal RemoteRunspacePoolInternal(Guid instanceId, string name, bool isDisconn
ConnectCommandInfo[] connectCommands, RunspaceConnectionInfo connectionInfo, PSHost host, TypeTable typeTable)
: base(1, 1)
{
if (instanceId == null)
if (instanceId == Guid.Empty)
{
throw PSTraceSource.NewArgumentNullException("RunspacePool Guid");
throw PSTraceSource.NewArgumentException(nameof(instanceId));
}

if (connectCommands == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ private void populateDelegates()
private void CleanUpDelegates()
{
// Free GCHandles so that the memory they point to may be unpinned (garbage collected)
if (_pluginShellGCHandle != null)
if (_pluginShellGCHandle.IsAllocated)
{
_pluginShellGCHandle.Free();
_pluginReleaseShellContextGCHandle.Free();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2280,7 +2280,7 @@ private static void OnRemoteSessionConnectCallback(IntPtr operationContext,
}

// process returned Xml
Dbg.Assert(data != null, "WSManConnectShell callback returned null data");
Dbg.Assert(data != IntPtr.Zero, "WSManConnectShell callback returned null data");
WSManNativeApi.WSManConnectDataResult connectData = WSManNativeApi.WSManConnectDataResult.UnMarshal(data);
if (connectData.data != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private void populateDelegates()
private void CleanUpDelegates()
{
// Free GCHandles so that the memory they point to may be unpinned (garbage collected)
if (_fdiAllocHandle != null)
if (_fdiAllocHandle.IsAllocated)
{
_fdiAllocHandle.Free();
_fdiFreeHandle.Free();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal class UpdatableHelpModuleInfo
internal UpdatableHelpModuleInfo(string name, Guid guid, string path, string uri)
{
Debug.Assert(!string.IsNullOrEmpty(name));
Debug.Assert(guid != null);
Debug.Assert(guid != Guid.Empty);
Debug.Assert(!string.IsNullOrEmpty(path));
Debug.Assert(!string.IsNullOrEmpty(uri));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal class UpdatableHelpUri
internal UpdatableHelpUri(string moduleName, Guid moduleGuid, CultureInfo culture, string resolvedUri)
{
Debug.Assert(!string.IsNullOrEmpty(moduleName));
Debug.Assert(moduleGuid != null);
Debug.Assert(moduleGuid != Guid.Empty);
Debug.Assert(!string.IsNullOrEmpty(resolvedUri));

ModuleName = moduleName;
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/security/Authenticode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ internal static Signature SignFile(SigningOption option,
IntPtr.Zero);
#pragma warning restore 56523

if (si.pSignExtInfo != null)
if (si.pSignExtInfo != IntPtr.Zero)
{
Marshal.DestroyStructure<NativeMethods.CRYPTUI_WIZ_DIGITAL_SIGN_EXTENDED_INFO>(si.pSignExtInfo);
Marshal.FreeCoTaskMem(si.pSignExtInfo);
Expand Down