Skip to content

Commit c21f1e7

Browse files
committed
don't unload
1 parent 555461b commit c21f1e7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/FSharp.Test.Utilities/CompilerAssert.fs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace FSharp.Test
44

55
open System.Threading
6+
open OpenTelemetry.Resources
67

78
#nowarn "57"
89

@@ -376,23 +377,25 @@ module CompilerAssertHelpers =
376377
let setup = AppDomainSetup(ApplicationBase = thisAssemblyDirectory)
377378
let testCaseDomain = AppDomain.CreateDomain($"built app {assembly}", null, setup)
378379

379-
testCaseDomain.add_AssemblyResolve(fun _ args ->
380+
let handler = ResolveEventHandler(fun _ args ->
380381
dependecies
381382
|> List.tryFind (fun path -> Path.GetFileNameWithoutExtension path = AssemblyName(args.Name).Name)
382383
|> Option.filter FileSystem.FileExistsShim
383384
|> Option.map Assembly.LoadFile
384385
|> Option.toObj
385386
)
386387

388+
testCaseDomain.add_AssemblyResolve handler
389+
387390
let worker =
388391
(testCaseDomain.CreateInstanceFromAndUnwrap(typeof<Worker>.Assembly.CodeBase, typeof<Worker>.FullName)) :?> Worker
389392

390393
let outcome, output, errors = worker.ExecuteTestCase assembly isFsx
391394
// Replay streams captured in appdomain.
392395
printf $"{output}"
393396
eprintf $"{errors}"
394-
395-
AppDomain.Unload testCaseDomain
397+
398+
testCaseDomain.remove_AssemblyResolve handler
396399

397400
outcome, output, errors
398401

0 commit comments

Comments
 (0)