@@ -865,7 +865,7 @@ internal static Version ReadVersionValue(RegistryKey mshsnapinKey, string name,
865
865
return v ;
866
866
}
867
867
868
- internal static void ReadRegistryInfo ( out Version assemblyVersion , out string publicKeyToken , out string culture , out string architecture , out string applicationBase , out Version psVersion )
868
+ internal static void ReadRegistryInfo ( out Version assemblyVersion , out string publicKeyToken , out string culture , out string applicationBase , out Version psVersion )
869
869
{
870
870
applicationBase = Utils . DefaultPowerShellAppBase ;
871
871
Dbg . Assert (
@@ -885,8 +885,7 @@ internal static void ReadRegistryInfo(out Version assemblyVersion, out string pu
885
885
// culture, publickeytoken...This will break the scenarios where only one of
886
886
// the assemblies is patched. ie., all monad assemblies should have the
887
887
// same version number.
888
- Assembly currentAssembly = typeof ( PSSnapInReader ) . Assembly ;
889
- AssemblyName assemblyName = currentAssembly . GetName ( ) ;
888
+ AssemblyName assemblyName = typeof ( PSSnapInReader ) . Assembly . GetName ( ) ;
890
889
assemblyVersion = assemblyName . Version ;
891
890
byte [ ] publicTokens = assemblyName . GetPublicKeyToken ( ) ;
892
891
if ( publicTokens . Length == 0 )
@@ -899,11 +898,6 @@ internal static void ReadRegistryInfo(out Version assemblyVersion, out string pu
899
898
// save some cpu cycles by hardcoding the culture to neutral
900
899
// assembly should never be targeted to a particular culture
901
900
culture = "neutral" ;
902
-
903
- // Hardcoding the architecture MSIL as PowerShell assemblies are architecture neutral, this should
904
- // be changed if the assumption is broken. Preferred hardcoded string to using (for perf reasons):
905
- // string architecture = currentAssembly.GetName().ProcessorArchitecture.ToString()
906
- architecture = "MSIL" ;
907
901
}
908
902
909
903
/// <summary>
@@ -931,13 +925,12 @@ internal static string ConvertByteArrayToString(byte[] tokens)
931
925
/// </returns>
932
926
internal static PSSnapInInfo ReadCoreEngineSnapIn ( )
933
927
{
934
- Version assemblyVersion , psVersion ;
935
- string publicKeyToken = null ;
936
- string culture = null ;
937
- string architecture = null ;
938
- string applicationBase = null ;
939
-
940
- ReadRegistryInfo ( out assemblyVersion , out publicKeyToken , out culture , out architecture , out applicationBase , out psVersion ) ;
928
+ ReadRegistryInfo (
929
+ out Version assemblyVersion ,
930
+ out string publicKeyToken ,
931
+ out string culture ,
932
+ out string applicationBase ,
933
+ out Version psVersion ) ;
941
934
942
935
// System.Management.Automation formats & types files
943
936
Collection < string > types = new Collection < string > ( new string [ ] { "types.ps1xml" , "typesv3.ps1xml" } ) ;
@@ -946,8 +939,8 @@ internal static PSSnapInInfo ReadCoreEngineSnapIn()
946
939
"Help.format.ps1xml" , "HelpV3.format.ps1xml" , "PowerShellCore.format.ps1xml" , "PowerShellTrace.format.ps1xml" ,
947
940
"Registry.format.ps1xml" } ) ;
948
941
949
- string strongName = string . Format ( CultureInfo . InvariantCulture , "{0}, Version={1}, Culture={2}, PublicKeyToken={3}, ProcessorArchitecture={4} " ,
950
- s_coreSnapin . AssemblyName , assemblyVersion , culture , publicKeyToken , architecture ) ;
942
+ string strongName = string . Format ( CultureInfo . InvariantCulture , "{0}, Version={1}, Culture={2}, PublicKeyToken={3}" ,
943
+ s_coreSnapin . AssemblyName , assemblyVersion , culture , publicKeyToken ) ;
951
944
952
945
string moduleName = Path . Combine ( applicationBase , s_coreSnapin . AssemblyName + ".dll" ) ;
953
946
@@ -985,13 +978,12 @@ internal static PSSnapInInfo ReadCoreEngineSnapIn()
985
978
/// </returns>
986
979
internal static Collection < PSSnapInInfo > ReadEnginePSSnapIns ( )
987
980
{
988
- Version assemblyVersion , psVersion ;
989
- string publicKeyToken = null ;
990
- string culture = null ;
991
- string architecture = null ;
992
- string applicationBase = null ;
993
-
994
- ReadRegistryInfo ( out assemblyVersion , out publicKeyToken , out culture , out architecture , out applicationBase , out psVersion ) ;
981
+ ReadRegistryInfo (
982
+ out Version assemblyVersion ,
983
+ out string publicKeyToken ,
984
+ out string culture ,
985
+ out string applicationBase ,
986
+ out Version psVersion ) ;
995
987
996
988
// System.Management.Automation formats & types files
997
989
Collection < string > smaFormats = new Collection < string > ( new string [ ]
@@ -1010,12 +1002,11 @@ internal static Collection<PSSnapInInfo> ReadEnginePSSnapIns()
1010
1002
1011
1003
string strongName = string . Format (
1012
1004
CultureInfo . InvariantCulture ,
1013
- "{0}, Version={1}, Culture={2}, PublicKeyToken={3}, ProcessorArchitecture={4} " ,
1005
+ "{0}, Version={1}, Culture={2}, PublicKeyToken={3}" ,
1014
1006
defaultMshSnapinInfo . AssemblyName ,
1015
1007
assemblyVersionString ,
1016
1008
culture ,
1017
- publicKeyToken ,
1018
- architecture ) ;
1009
+ publicKeyToken ) ;
1019
1010
1020
1011
Collection < string > formats = null ;
1021
1012
Collection < string > types = null ;
0 commit comments