Skip to content

Commit 7098286

Browse files
adityapatwardhanalerickson
authored andcommitted
Do not call .NET methods to enable use on CLM (#1564)
1 parent a2c2d25 commit 7098286

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/code/ServerFactory.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License.
33

44
using Microsoft.PowerShell.PSResourceGet.UtilClasses;
5+
using System.Collections;
56
using System.Management.Automation;
67
using System.Management.Automation.Runspaces;
78
using System.Net;
@@ -14,7 +15,7 @@ static UserAgentInfo()
1415
{
1516
using (System.Management.Automation.PowerShell ps = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace))
1617
{
17-
_psVersion = ps.AddScript("$PSVersionTable.PSVersion.ToString()").Invoke<string>()[0];
18+
_psVersion = ps.AddScript("$PSVersionTable").Invoke<Hashtable>()[0]["PSVersion"].ToString();
1819
}
1920

2021
_psResourceGetVersion = typeof(UserAgentInfo).Assembly.GetName().Version.ToString();

0 commit comments

Comments
 (0)