Skip to content

Commit a44d71f

Browse files
committed
added isolated loadcontext to .NET 8.0 SDK test
1 parent 331b4c1 commit a44d71f

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/Dotnet.Script.Tests/ScriptExecutionTests.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -497,12 +497,18 @@ public void ShouldCompileAndExecuteWithWebSdk()
497497
var processResult = ScriptTestRunner.Default.ExecuteFixture("WebApi", "--no-cache");
498498
Assert.Equal(0, processResult.ExitCode);
499499
}
500-
#endif
501-
// todo: the same test should run for .NET 8.0 - currently it fails with
502-
// System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
503-
// ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
504-
// Could not find or load a specific file. (0x80131621)
505-
500+
#endif
501+
502+
#if NET8_0
503+
// .NET 8.0 only works with isolated load context
504+
[Fact]
505+
public void ShouldCompileAndExecuteWithWebSdk()
506+
{
507+
var processResult = ScriptTestRunner.Default.ExecuteFixture("WebApi", "--no-cache --isolated-load-context");
508+
Assert.Equal(0, processResult.ExitCode);
509+
}
510+
#endif
511+
506512
[Fact]
507513
public void ShouldThrowExceptionWhenSdkIsNotSupported()
508514
{

src/Dotnet.Script.Tests/TestFixtures/WebApi/WebApi.csx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#r "sdk:Microsoft.NET.Sdk.Web"
2+
#r "nuget:Microsoft.Extensions.DependencyInjection.Abstractions, 8.0.0-rc.2.23479.6"
23

34
using Microsoft.AspNetCore.Builder;
45

0 commit comments

Comments
 (0)