Remove BuildVersion from $PSVersionTable (#3877)
* Remove BuildVersion from PSVersionInfo type * Fix error messages * Remove BuildVersion from tests
This commit is contained in:
parent
820e96d062
commit
9c42d2d030
|
@ -20,7 +20,6 @@ namespace System.Management.Automation
|
||||||
internal const string PSRemotingProtocolVersionName = "PSRemotingProtocolVersion";
|
internal const string PSRemotingProtocolVersionName = "PSRemotingProtocolVersion";
|
||||||
internal const string PSVersionName = "PSVersion";
|
internal const string PSVersionName = "PSVersion";
|
||||||
internal const string PSEditionName = "PSEdition";
|
internal const string PSEditionName = "PSEdition";
|
||||||
internal const string PSBuildVersionName = "BuildVersion";
|
|
||||||
internal const string PSGitCommitIdName = "GitCommitId";
|
internal const string PSGitCommitIdName = "GitCommitId";
|
||||||
internal const string PSCompatibleVersionsName = "PSCompatibleVersions";
|
internal const string PSCompatibleVersionsName = "PSCompatibleVersions";
|
||||||
internal const string PSCLRVersionName = "CLRVersion";
|
internal const string PSCLRVersionName = "CLRVersion";
|
||||||
|
@ -65,7 +64,6 @@ namespace System.Management.Automation
|
||||||
|
|
||||||
s_psVersionTable[PSVersionInfo.PSVersionName] = s_psV6Version;
|
s_psVersionTable[PSVersionInfo.PSVersionName] = s_psV6Version;
|
||||||
s_psVersionTable[PSVersionInfo.PSEditionName] = PSEditionValue;
|
s_psVersionTable[PSVersionInfo.PSEditionName] = PSEditionValue;
|
||||||
s_psVersionTable[PSBuildVersionName] = GetBuildVersion();
|
|
||||||
s_psVersionTable[PSGitCommitIdName] = GetCommitInfo();
|
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[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);
|
s_psVersionTable[PSVersionInfo.SerializationVersionName] = new Version(InternalSerializer.DefaultVersion);
|
||||||
|
@ -94,13 +92,6 @@ namespace System.Management.Automation
|
||||||
return result;
|
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"
|
// 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()
|
internal static string GetCommitInfo()
|
||||||
{
|
{
|
||||||
|
@ -179,14 +170,6 @@ namespace System.Management.Automation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static Version BuildVersion
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return (Version)GetPSVersionTable()[PSBuildVersionName];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static Version[] PSCompatibleVersions
|
internal static Version[] PSCompatibleVersions
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -531,7 +531,7 @@ namespace System.Management.Automation.Remoting
|
||||||
new PSRemotingDataStructureException(RemotingErrorIdStrings.ClientNegotiationFailed,
|
new PSRemotingDataStructureException(RemotingErrorIdStrings.ClientNegotiationFailed,
|
||||||
RemoteDataNameStrings.PS_STARTUP_PROTOCOL_VERSION_NAME,
|
RemoteDataNameStrings.PS_STARTUP_PROTOCOL_VERSION_NAME,
|
||||||
serverProtocolVersion,
|
serverProtocolVersion,
|
||||||
PSVersionInfo.BuildVersion,
|
PSVersionInfo.GitCommitId,
|
||||||
RemotingConstants.ProtocolVersion);
|
RemotingConstants.ProtocolVersion);
|
||||||
throw reasonOfFailure;
|
throw reasonOfFailure;
|
||||||
}
|
}
|
||||||
|
@ -545,7 +545,7 @@ namespace System.Management.Automation.Remoting
|
||||||
new PSRemotingDataStructureException(RemotingErrorIdStrings.ClientNegotiationFailed,
|
new PSRemotingDataStructureException(RemotingErrorIdStrings.ClientNegotiationFailed,
|
||||||
RemoteDataNameStrings.PSVersion,
|
RemoteDataNameStrings.PSVersion,
|
||||||
serverPSVersion.ToString(),
|
serverPSVersion.ToString(),
|
||||||
PSVersionInfo.BuildVersion,
|
PSVersionInfo.GitCommitId,
|
||||||
RemotingConstants.ProtocolVersion);
|
RemotingConstants.ProtocolVersion);
|
||||||
throw reasonOfFailure;
|
throw reasonOfFailure;
|
||||||
}
|
}
|
||||||
|
@ -559,7 +559,7 @@ namespace System.Management.Automation.Remoting
|
||||||
new PSRemotingDataStructureException(RemotingErrorIdStrings.ClientNegotiationFailed,
|
new PSRemotingDataStructureException(RemotingErrorIdStrings.ClientNegotiationFailed,
|
||||||
RemoteDataNameStrings.SerializationVersion,
|
RemoteDataNameStrings.SerializationVersion,
|
||||||
serverSerVersion.ToString(),
|
serverSerVersion.ToString(),
|
||||||
PSVersionInfo.BuildVersion,
|
PSVersionInfo.GitCommitId,
|
||||||
RemotingConstants.ProtocolVersion);
|
RemotingConstants.ProtocolVersion);
|
||||||
throw reasonOfFailure;
|
throw reasonOfFailure;
|
||||||
}
|
}
|
||||||
|
|
|
@ -638,7 +638,7 @@ namespace System.Management.Automation.Remoting
|
||||||
// this will happen if expected properties are not
|
// this will happen if expected properties are not
|
||||||
// received for session capability
|
// received for session capability
|
||||||
throw new PSRemotingDataStructureException(RemotingErrorIdStrings.ClientNotFoundCapabilityProperties,
|
throw new PSRemotingDataStructureException(RemotingErrorIdStrings.ClientNotFoundCapabilityProperties,
|
||||||
dse.Message, PSVersionInfo.BuildVersion, RemotingConstants.ProtocolVersion);
|
dse.Message, PSVersionInfo.GitCommitId, RemotingConstants.ProtocolVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteSessionStateMachineEventArgs capabilityArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.NegotiationReceived);
|
RemoteSessionStateMachineEventArgs capabilityArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.NegotiationReceived);
|
||||||
|
|
|
@ -1056,7 +1056,7 @@ namespace System.Management.Automation.Remoting
|
||||||
StringUtil.Format(
|
StringUtil.Format(
|
||||||
RemotingErrorIdStrings.WSManPluginOptionNotUnderstood,
|
RemotingErrorIdStrings.WSManPluginOptionNotUnderstood,
|
||||||
option.name,
|
option.name,
|
||||||
System.Management.Automation.PSVersionInfo.BuildVersion,
|
System.Management.Automation.PSVersionInfo.GitCommitId,
|
||||||
WSManPluginConstants.PowerShellStartupProtocolVersionValue));
|
WSManPluginConstants.PowerShellStartupProtocolVersionValue));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1071,7 +1071,7 @@ namespace System.Management.Automation.Remoting
|
||||||
StringUtil.Format(
|
StringUtil.Format(
|
||||||
RemotingErrorIdStrings.WSManPluginProtocolVersionNotFound,
|
RemotingErrorIdStrings.WSManPluginProtocolVersionNotFound,
|
||||||
WSManPluginConstants.PowerShellStartupProtocolVersionName,
|
WSManPluginConstants.PowerShellStartupProtocolVersionName,
|
||||||
System.Management.Automation.PSVersionInfo.BuildVersion,
|
System.Management.Automation.PSVersionInfo.GitCommitId,
|
||||||
WSManPluginConstants.PowerShellStartupProtocolVersionValue));
|
WSManPluginConstants.PowerShellStartupProtocolVersionValue));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1113,7 +1113,7 @@ namespace System.Management.Automation.Remoting
|
||||||
StringUtil.Format(
|
StringUtil.Format(
|
||||||
RemotingErrorIdStrings.WSManPluginProtocolVersionNotMatch,
|
RemotingErrorIdStrings.WSManPluginProtocolVersionNotMatch,
|
||||||
WSManPluginConstants.PowerShellStartupProtocolVersionValue,
|
WSManPluginConstants.PowerShellStartupProtocolVersionValue,
|
||||||
System.Management.Automation.PSVersionInfo.BuildVersion,
|
System.Management.Automation.PSVersionInfo.GitCommitId,
|
||||||
clientVersionString));
|
clientVersionString));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1042,7 +1042,7 @@ namespace System.Management.Automation.Remoting
|
||||||
new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerConnectFailedOnNegotiation,
|
new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerConnectFailedOnNegotiation,
|
||||||
RemoteDataNameStrings.PS_STARTUP_PROTOCOL_VERSION_NAME,
|
RemoteDataNameStrings.PS_STARTUP_PROTOCOL_VERSION_NAME,
|
||||||
clientProtocolVersion,
|
clientProtocolVersion,
|
||||||
PSVersionInfo.BuildVersion,
|
PSVersionInfo.GitCommitId,
|
||||||
RemotingConstants.ProtocolVersion);
|
RemotingConstants.ProtocolVersion);
|
||||||
throw reasonOfFailure;
|
throw reasonOfFailure;
|
||||||
}
|
}
|
||||||
|
@ -1092,7 +1092,7 @@ namespace System.Management.Automation.Remoting
|
||||||
new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerNegotiationFailed,
|
new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerNegotiationFailed,
|
||||||
RemoteDataNameStrings.PS_STARTUP_PROTOCOL_VERSION_NAME,
|
RemoteDataNameStrings.PS_STARTUP_PROTOCOL_VERSION_NAME,
|
||||||
clientProtocolVersion,
|
clientProtocolVersion,
|
||||||
PSVersionInfo.BuildVersion,
|
PSVersionInfo.GitCommitId,
|
||||||
RemotingConstants.ProtocolVersion);
|
RemotingConstants.ProtocolVersion);
|
||||||
throw reasonOfFailure;
|
throw reasonOfFailure;
|
||||||
}
|
}
|
||||||
|
@ -1108,7 +1108,7 @@ namespace System.Management.Automation.Remoting
|
||||||
new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerNegotiationFailed,
|
new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerNegotiationFailed,
|
||||||
RemoteDataNameStrings.PSVersion,
|
RemoteDataNameStrings.PSVersion,
|
||||||
clientPSVersion,
|
clientPSVersion,
|
||||||
PSVersionInfo.BuildVersion,
|
PSVersionInfo.GitCommitId,
|
||||||
RemotingConstants.ProtocolVersion);
|
RemotingConstants.ProtocolVersion);
|
||||||
throw reasonOfFailure;
|
throw reasonOfFailure;
|
||||||
}
|
}
|
||||||
|
@ -1123,7 +1123,7 @@ namespace System.Management.Automation.Remoting
|
||||||
new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerNegotiationFailed,
|
new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerNegotiationFailed,
|
||||||
RemoteDataNameStrings.SerializationVersion,
|
RemoteDataNameStrings.SerializationVersion,
|
||||||
clientSerVersion,
|
clientSerVersion,
|
||||||
PSVersionInfo.BuildVersion,
|
PSVersionInfo.GitCommitId,
|
||||||
RemotingConstants.ProtocolVersion);
|
RemotingConstants.ProtocolVersion);
|
||||||
throw reasonOfFailure;
|
throw reasonOfFailure;
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,7 @@ namespace System.Management.Automation.Remoting
|
||||||
// this will happen if expected properties are not
|
// this will happen if expected properties are not
|
||||||
// received for session capability
|
// received for session capability
|
||||||
throw new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerNotFoundCapabilityProperties,
|
throw new PSRemotingDataStructureException(RemotingErrorIdStrings.ServerNotFoundCapabilityProperties,
|
||||||
dse.Message, PSVersionInfo.BuildVersion, RemotingConstants.ProtocolVersion);
|
dse.Message, PSVersionInfo.GitCommitId, RemotingConstants.ProtocolVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteSessionStateMachineEventArgs capabilityArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.NegotiationReceived);
|
RemoteSessionStateMachineEventArgs capabilityArg = new RemoteSessionStateMachineEventArgs(RemoteSessionEvent.NegotiationReceived);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Describe "PSVersionTable" -Tags "CI" {
|
Describe "PSVersionTable" -Tags "CI" {
|
||||||
It "Should have version table entries" {
|
It "Should have version table entries" {
|
||||||
$PSVersionTable.Count | Should Be 11
|
$PSVersionTable.Count | Should Be 10
|
||||||
}
|
}
|
||||||
|
|
||||||
It "Should have the right version table entries" {
|
It "Should have the right version table entries" {
|
||||||
|
@ -9,7 +9,6 @@ Describe "PSVersionTable" -Tags "CI" {
|
||||||
$PSVersionTable.ContainsKey("WSManStackVersion") | Should Be True
|
$PSVersionTable.ContainsKey("WSManStackVersion") | Should Be True
|
||||||
$PSVersionTable.ContainsKey("SerializationVersion") | Should Be True
|
$PSVersionTable.ContainsKey("SerializationVersion") | Should Be True
|
||||||
$PSVersionTable.ContainsKey("CLRVersion") | Should Be True
|
$PSVersionTable.ContainsKey("CLRVersion") | Should Be True
|
||||||
$PSVersionTable.ContainsKey("BuildVersion") | Should Be True
|
|
||||||
$PSVersionTable.ContainsKey("PSCompatibleVersions") | Should Be True
|
$PSVersionTable.ContainsKey("PSCompatibleVersions") | Should Be True
|
||||||
$PSVersionTable.ContainsKey("PSRemotingProtocolVersion") | Should Be True
|
$PSVersionTable.ContainsKey("PSRemotingProtocolVersion") | Should Be True
|
||||||
$PSVersionTable.ContainsKey("GitCommitId") | Should Be True
|
$PSVersionTable.ContainsKey("GitCommitId") | Should Be True
|
||||||
|
|
Loading…
Reference in a new issue