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 @@ -165,10 +165,13 @@ protected void GetCimInstanceInternal(CimBaseCommand cmdlet)
case CimBaseCommand.CimInstanceSessionSet:
{
CimInstance instance = GetCimInstanceParameter(cmdlet);
nameSpace = ConstValue.GetNamespace(instance.CimSystemProperties.Namespace);
foreach (CimSessionProxy proxy in proxys)
if (instance != null)
{
proxy.GetInstanceAsync(nameSpace, instance);
nameSpace = ConstValue.GetNamespace(instance.CimSystemProperties.Namespace);
foreach (CimSessionProxy proxy in proxys)
{
proxy.GetInstanceAsync(nameSpace, instance);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ internal static class DebugHelper
/// <summary>
/// Whether the log been initialized.
/// </summary>
private static bool logInitialized = false;
private static volatile bool logInitialized = false;

internal static bool GenerateVerboseMessage { get; set; } = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public ShowCommandCommandInfo(PSObject other)
{
// Simple case - the objects are still live because they came from in-proc. Just cast them back
this.CommandType = (CommandTypes)(other.Members["CommandType"].Value);
this.Module = other.Members["Module"].Value as ShowCommandModuleInfo;
this.Module = other.Members["Module"]?.Value as ShowCommandModuleInfo;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -821,14 +821,14 @@ internal LocalRunspace LocalRunspace
{
get
{
if (_isRunspacePushed)
if (RunspaceRef == null)
{
return RunspaceRef.OldRunspace as LocalRunspace;
return null;
}

if (RunspaceRef == null)
if (_isRunspacePushed)
{
return null;
return RunspaceRef.OldRunspace as LocalRunspace;
}

return RunspaceRef.Runspace as LocalRunspace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,17 @@ private static ViewDefinition GetView(PSPropertyExpressionFactory expressionFact
TypeMatch match = new TypeMatch(expressionFactory, db, typeNames);
foreach (ViewDefinition vd in db.viewDefinitionsSection.viewDefinitionList)
{
if (vd == null || mainControlType != vd.mainControl.GetType())
if (vd == null)
{
ActiveTracer.WriteLine("NOT MATCH null view definition");
continue;
}

if (mainControlType != vd.mainControl.GetType())
{
ActiveTracer.WriteLine(
"NOT MATCH {0} NAME: {1}",
ControlBase.GetControlShapeName(vd.mainControl), (vd != null ? vd.name : string.Empty));
ControlBase.GetControlShapeName(vd.mainControl), vd.name);
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/utils/StringUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ internal static string VtSubstring(this string str, int startOffset, int length,
}
else
{
int capacity = length + prependStr?.Length ?? 0 + appendStr?.Length ?? 0;
int capacity = length + (prependStr?.Length ?? 0) + (appendStr?.Length ?? 0);
return new StringBuilder(prependStr, capacity)
.Append(str, startOffset, length)
.Append(appendStr)
Expand Down