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
17 changes: 0 additions & 17 deletions src/System.Management.Automation/engine/PSVersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ internal class PSVersionInfo
internal const string PSRemotingProtocolVersionName = "PSRemotingProtocolVersion";
internal const string PSVersionName = "PSVersion";
internal const string PSEditionName = "PSEdition";
internal const string PSBuildVersionName = "BuildVersion";
internal const string PSGitCommitIdName = "GitCommitId";
internal const string PSCompatibleVersionsName = "PSCompatibleVersions";
internal const string PSCLRVersionName = "CLRVersion";
Expand Down Expand Up @@ -65,7 +64,6 @@ static PSVersionInfo()

s_psVersionTable[PSVersionInfo.PSVersionName] = s_psV6Version;
s_psVersionTable[PSVersionInfo.PSEditionName] = PSEditionValue;
s_psVersionTable[PSBuildVersionName] = GetBuildVersion();
s_psVersionTable[PSGitCommitIdName] = GetCommitInfo();
s_psVersionTable[PSCompatibleVersionsName] = new Version[] { s_psV1Version, s_psV2Version, s_psV3Version, s_psV4Version, s_psV5Version, s_psV51Version, s_psV6Version };
s_psVersionTable[PSVersionInfo.SerializationVersionName] = new Version(InternalSerializer.DefaultVersion);
Expand Down Expand Up @@ -94,13 +92,6 @@ internal static Hashtable GetPSVersionTableForDownLevel()
return result;
}

internal static Version GetBuildVersion()
{
string assemblyPath = typeof(PSVersionInfo).GetTypeInfo().Assembly.Location;
string buildVersion = FileVersionInfo.GetVersionInfo(assemblyPath).FileVersion;
return new Version(buildVersion);
}

// Get the commit id from the powershell.version file. If the powershell.version file doesn't exist, use the string "N/A"
internal static string GetCommitInfo()
{
Expand Down Expand Up @@ -179,14 +170,6 @@ internal static Version CLRVersion
}
}

internal static Version BuildVersion
{
get
{
return (Version)GetPSVersionTable()[PSBuildVersionName];
}
}

internal static Version[] PSCompatibleVersions
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ private bool RunClientNegotiationAlgorithm(RemoteSessionCapability serverRemoteS
new PSRemotingDataStructureException(RemotingErrorIdStrings.ClientNegotiationFailed,
RemoteDataNameStrings.PS_STARTUP_PROTOCOL_VERSION_NAME,
serverProtocolVersion,
PSVersionInfo.BuildVersion,
PSVersionInfo.GitCommitId,
RemotingConstants.ProtocolVersion);
throw reasonOfFailure;
}
Expand All @@ -545,7 +545,7 @@ private bool RunClientNegotiationAlgorithm(RemoteSessionCapability serverRemoteS
new PSRemotingDataStructureException(RemotingErrorIdStrings.ClientNegotiationFailed,
RemoteDataNameStrings.PSVersion,
serverPSVersion.ToString(),
PSVersionInfo.BuildVersion,
PSVersionInfo.GitCommitId,
RemotingConstants.ProtocolVersion);
throw reasonOfFailure;
}
Expand All @@ -559,7 +559,7 @@ private bool RunClientNegotiationAlgorithm(RemoteSessionCapability serverRemoteS
new PSRemotingDataStructureException(RemotingErrorIdStrings.ClientNegotiationFailed,
RemoteDataNameStrings.SerializationVersion,
serverSerVersion.ToString(),
PSVersionInfo.BuildVersion,
PSVersionInfo.GitCommitId,
RemotingConstants.ProtocolVersion);
throw reasonOfFailure;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ private void ProcessSessionMessages(RemoteDataEventArgs arg)
// this will happen if expected properties are not
// received for session capability
throw new PSRemotingDataStructureException(RemotingErrorIdStrings.ClientNotFoundCapabilityProperties,
dse.Message, PSVersionInfo.BuildVersion, RemotingConstants.ProtocolVersion);
dse.Message, PSVersionInfo.GitCommitId, RemotingConstants.ProtocolVersion);
}

RemoteSessionStateMachineEventArgs capabilityArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.NegotiationReceived);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ protected internal bool EnsureOptionsComply(
StringUtil.Format(
RemotingErrorIdStrings.WSManPluginOptionNotUnderstood,
option.name,
System.Management.Automation.PSVersionInfo.BuildVersion,
System.Management.Automation.PSVersionInfo.GitCommitId,
WSManPluginConstants.PowerShellStartupProtocolVersionValue));
return false;
}
Expand All @@ -1071,7 +1071,7 @@ protected internal bool EnsureOptionsComply(
StringUtil.Format(
RemotingErrorIdStrings.WSManPluginProtocolVersionNotFound,
WSManPluginConstants.PowerShellStartupProtocolVersionName,
System.Management.Automation.PSVersionInfo.BuildVersion,
System.Management.Automation.PSVersionInfo.GitCommitId,
WSManPluginConstants.PowerShellStartupProtocolVersionValue));
return false;
}
Expand Down Expand Up @@ -1113,7 +1113,7 @@ protected internal bool EnsureProtocolVersionComplies(
StringUtil.Format(
RemotingErrorIdStrings.WSManPluginProtocolVersionNotMatch,
WSManPluginConstants.PowerShellStartupProtocolVersionValue,
System.Management.Automation.PSVersionInfo.BuildVersion,
System.Management.Automation.PSVersionInfo.GitCommitId,
clientVersionString));
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ private bool RunServerNegotiationAlgorithm(RemoteSessionCapability clientCapabil
new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerConnectFailedOnNegotiation,
RemoteDataNameStrings.PS_STARTUP_PROTOCOL_VERSION_NAME,
clientProtocolVersion,
PSVersionInfo.BuildVersion,
PSVersionInfo.GitCommitId,
RemotingConstants.ProtocolVersion);
throw reasonOfFailure;
}
Expand Down Expand Up @@ -1092,7 +1092,7 @@ private bool RunServerNegotiationAlgorithm(RemoteSessionCapability clientCapabil
new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerNegotiationFailed,
RemoteDataNameStrings.PS_STARTUP_PROTOCOL_VERSION_NAME,
clientProtocolVersion,
PSVersionInfo.BuildVersion,
PSVersionInfo.GitCommitId,
RemotingConstants.ProtocolVersion);
throw reasonOfFailure;
}
Expand All @@ -1108,7 +1108,7 @@ private bool RunServerNegotiationAlgorithm(RemoteSessionCapability clientCapabil
new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerNegotiationFailed,
RemoteDataNameStrings.PSVersion,
clientPSVersion,
PSVersionInfo.BuildVersion,
PSVersionInfo.GitCommitId,
RemotingConstants.ProtocolVersion);
throw reasonOfFailure;
}
Expand All @@ -1123,7 +1123,7 @@ private bool RunServerNegotiationAlgorithm(RemoteSessionCapability clientCapabil
new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerNegotiationFailed,
RemoteDataNameStrings.SerializationVersion,
clientSerVersion,
PSVersionInfo.BuildVersion,
PSVersionInfo.GitCommitId,
RemotingConstants.ProtocolVersion);
throw reasonOfFailure;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ internal override void RaiseDataReceivedEvent(RemoteDataEventArgs dataArg)
// this will happen if expected properties are not
// received for session capability
throw new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerNotFoundCapabilityProperties,
dse.Message, PSVersionInfo.BuildVersion, RemotingConstants.ProtocolVersion);
dse.Message, PSVersionInfo.GitCommitId, RemotingConstants.ProtocolVersion);
}

RemoteSessionStateMachineEventArgs capabilityArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.NegotiationReceived);
Expand Down
3 changes: 1 addition & 2 deletions test/powershell/Host/PSVersionTable.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Describe "PSVersionTable" -Tags "CI" {
It "Should have version table entries" {
$PSVersionTable.Count | Should Be 11
$PSVersionTable.Count | Should Be 10
}

It "Should have the right version table entries" {
Expand All @@ -9,7 +9,6 @@ Describe "PSVersionTable" -Tags "CI" {
$PSVersionTable.ContainsKey("WSManStackVersion") | Should Be True
$PSVersionTable.ContainsKey("SerializationVersion") | Should Be True
$PSVersionTable.ContainsKey("CLRVersion") | Should Be True
$PSVersionTable.ContainsKey("BuildVersion") | Should Be True
$PSVersionTable.ContainsKey("PSCompatibleVersions") | Should Be True
$PSVersionTable.ContainsKey("PSRemotingProtocolVersion") | Should Be True
$PSVersionTable.ContainsKey("GitCommitId") | Should Be True
Expand Down