Skip to content

Commit 6b5d945

Browse files
author
Kapil Borle
committed
Compile engine on CoreCLR
1 parent abb1e06 commit 6b5d945

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

Engine/Generic/ModuleDependencyHandler.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,17 @@ public string LocalAppDataPath
6969
}
7070
private set
7171
{
72+
#if CORECLR
73+
localAppdataPath
74+
= string.IsNullOrWhiteSpace(value)
75+
? Environment.GetEnvironmentVariable("LOCALAPPDATA")
76+
: value;
77+
#else
7278
localAppdataPath
7379
= string.IsNullOrWhiteSpace(value)
7480
? Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
7581
: value;
82+
#endif
7683
}
7784
}
7885

@@ -194,7 +201,8 @@ private string GetPSSATempDirPath()
194201
private string GetTempModulePath(string symLinkPath)
195202
{
196203
string line;
197-
using (var fileStream = new StreamReader(symLinkPath))
204+
using (var file = File.Open(symLinkPath, FileMode.Open))
205+
using (var fileStream = new StreamReader(file))
198206
{
199207
line = fileStream.ReadLine();
200208
}
@@ -220,12 +228,21 @@ private void SetupPSModulePath()
220228
{
221229
oldPSModulePath = Environment.GetEnvironmentVariable("PSModulePath");
222230
curPSModulePath = oldPSModulePath + ";" + tempModulePath;
231+
#if CORECLR
232+
Environment.SetEnvironmentVariable("PSModulePath", curPSModulePath);
233+
#else
223234
Environment.SetEnvironmentVariable("PSModulePath", curPSModulePath, EnvironmentVariableTarget.Process);
235+
#endif
224236
}
225237

226238
private void RestorePSModulePath()
227239
{
240+
241+
#if CORECLR
242+
Environment.SetEnvironmentVariable("PSModulePath", oldPSModulePath);
243+
#else
228244
Environment.SetEnvironmentVariable("PSModulePath", oldPSModulePath, EnvironmentVariableTarget.Process);
245+
#endif
229246
}
230247
#endregion Private Methods
231248

Engine/VariableAnalysisBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,11 +1725,11 @@ public static Type DeepestRelatedDerivedClass(Type FirstType, Type SecondType)
17251725
return typeof(object);
17261726
}
17271727

1728-
if (FirstType.IsSubclassOf(SecondType) || FirstType == SecondType)
1728+
if (FirstType.GetTypeInfo().IsSubclassOf(SecondType) || FirstType == SecondType)
17291729
{
17301730
return FirstType;
17311731
}
1732-
else if (SecondType.IsSubclassOf(FirstType))
1732+
else if (SecondType.GetTypeInfo().IsSubclassOf(FirstType))
17331733
{
17341734
return SecondType;
17351735
}

0 commit comments

Comments
 (0)