Skip to content

Commit acafb4c

Browse files
committed
Remove OS/process info gathering in CoreCLR
This change temporarily removes the OS and process information gathering from the CoreCLR version of PowerShell Editor Services because they cause assembly loading errors. This should be resolved by the upcoming conversion to the dotnet cli tools. Future resolution tracked by #278.
1 parent 9234e3f commit acafb4c

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/PowerShellEditorServices.Host/EditorServicesHost.cs

+17-6
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,20 @@ public void StartLogging(string logFilePath, LogLevel logLevel)
9696
{
9797
Logger.Initialize(logFilePath, logLevel);
9898

99-
FileVersionInfo fileVersionInfo =
10099
#if NanoServer
100+
FileVersionInfo fileVersionInfo =
101101
FileVersionInfo.GetVersionInfo(this.GetType().GetTypeInfo().Assembly.Location);
102+
103+
// TODO #278: Need the correct dependency package for this to work correctly
104+
//string osVersionString = RuntimeInformation.OSDescription;
105+
//string processArchitecture = RuntimeInformation.ProcessArchitecture == Architecture.X64 ? "64-bit" : "32-bit";
106+
//string osArchitecture = RuntimeInformation.OSArchitecture == Architecture.X64 ? "64-bit" : "32-bit";
102107
#else
108+
FileVersionInfo fileVersionInfo =
103109
FileVersionInfo.GetVersionInfo(this.GetType().Assembly.Location);
110+
string osVersionString = Environment.OSVersion.VersionString;
111+
string processArchitecture = Environment.Is64BitProcess ? "64-bit" : "32-bit";
112+
string osArchitecture = Environment.Is64BitOperatingSystem ? "64-bit" : "32-bit";
104113
#endif
105114

106115
string newLine = Environment.NewLine;
@@ -113,12 +122,14 @@ public void StartLogging(string logFilePath, LogLevel logLevel)
113122
$" Name: {this.hostDetails.Name}" + newLine +
114123
$" ProfileId: {this.hostDetails.ProfileId}" + newLine +
115124
$" Version: {this.hostDetails.Version}" + newLine +
116-
" Arch: {0}" + newLine + newLine +
125+
#if !NanoServer
126+
$" Arch: {processArchitecture}" + newLine + newLine +
117127
" Operating system details:" + newLine + newLine +
118-
$" Version: {Environment.OSVersion.VersionString}" + newLine +
119-
" Arch: {1}",
120-
Environment.Is64BitProcess ? "64-bit" : "32-bit",
121-
Environment.Is64BitOperatingSystem ? "64-bit" : "32-bit"));
128+
$" Version: {osVersionString}" + newLine +
129+
$" Arch: {osArchitecture}"));
130+
#else
131+
""));
132+
#endif
122133
}
123134

124135
/// <summary>

0 commit comments

Comments
 (0)