-
Notifications
You must be signed in to change notification settings - Fork 831
Description
The static constructor of DotNetFrameworkDependencies throws an ArgumentNullException when FSharp.Compiler.Service doesn't have a disk presence. This occurs when FSharp.Compiler.Service.dll is loaded directly into memory with Assembly.Load(byte[]); for instance, as is the case if you're using Microsoft's new single-file executable deployment feature in .NET Core.
The problem is in this line of code:
let fSharpCompilerLocation =
let location = Path.GetDirectoryName(typeof<TypeInThisAssembly>.Assembly.Location)
This evaluates to null when FSharp.Compiler.Service.dll doesn't have a disk presence, which then
causes an ArgumentNullException to be thrown when later calling Path.Combine:
let getDefaultFSharpCoreLocation = Path.Combine(fSharpCompilerLocation, getFSharpCoreLibraryName + ".dll")
The call to Path.Combine fails when fSharpCompilerLocation is null.
Note that this problem has just appeared in version 34 of FSharp.Compiler.Service. It did not occur in version 33.