You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
since release of FCS 34.0.1: FSharp.Core.dll was not found or is invalid #9064
Since release of FSharp.Compiler.Service 34.0.1 (and higher versions too) I get this error
error FS0084: Assembly reference 'FSharp.Core.dll' was not found or is invalid
when calling FsiEvaluationSession.Create(...) hosted in a Rhino3dPlugin
Is version 33.0.1 using another version of FSharp.Core than 34.0.1 ?
May it be possible to fix this by telling the Rhino.PlugIn how to explicitly reference FSharp.Core ?
With binding redirects?
cc @sbaer@jesterKing
Is there a way to have more diagnostic error messages? @cartermp , unfortunately removing the FSharp.Core package reference did not help.
how is dotnet build deciding which version of FSharp.Core to put in the output folder now? @sbaer Explicitly loading it does not make a change either.
@dsyme Yes, it would be great if you could look at the test repro. Follow the steps in the readme.
I just tried with the latest 37.0.0 nuget. same message:
Microsoft (R) F# Interactive version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.
For help type #help;;
>
error FS0084: Assembly reference 'FSharp.Core.dll' was not found or is invalid
Would it be possible to have a better error message? Detailing why it is invalid ?
With FCS 40.0 I still get the same StopProcessingExn exception in FSharp.Compiler.Interactive.Shell.FsiEvaluationSession..ctor(..)
in addition, the FSI error stream says:
error FS0078: Unable to find the file 'FSharp.Core.dll' in any of
C:\Windows\Microsoft.NET\Framework64\v4.0.30319
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WPF
C:\Program Files\Rhino 7\System
C:\Program Files\Rhino 7\System\
however, I can't put Fsharp.Core in any of those directories because of insufficient user rights.
Is there any way to make the FsiEvaluationSession constructor load FSharp.Core.dll from the same location as FSharp.Compiler.Service.dll ?
After more than a year, I finally managed to fix this. 🎉
The constructor of FsiEvaluationSession queries the current directory.
However, when FCS is hosted in another app, this directory probably does not contain FSharp.Core.dll in my case it is C:\Program Files\Rhino 7\System\
So to fix this, I had to set the current directory to the location of FSharp.Core.dll befor calling FsiEvaluationSession.Create(...) . I added: Directory.SetCurrentDirectory(Path.GetDirectoryName(Reflection.Assembly.GetAssembly([].GetType()).Location))
Now it works !
Activity
sbaer commentedon Apr 28, 2020
You could try forcing FSharp.Core.dll to load by using Assembly.LoadFrom in the plug-in's OnLoadPlugIn override.
cartermp commentedon Apr 28, 2020
@goswinr Try removing this:
<PackageReference Update="FSharp.Core" Version="4.7.0" />Explicit FSharp.Core references are only useful for library authors looking to pin their lowest-compatible FSharp.Core for consumers.
goswinr commentedon Apr 29, 2020
Is there a way to have more diagnostic error messages?
@cartermp , unfortunately removing the FSharp.Core package reference did not help.
how is
dotnet builddeciding which version of FSharp.Core to put in the output folder now?@sbaer Explicitly loading it does not make a change either.
I included these suggestions in the test repro.
dsyme commentedon Sep 3, 2020
@goswinr Did you make progress on this? I can look at your repro if you like
goswinr commentedon Sep 4, 2020
@dsyme Yes, it would be great if you could look at the test repro. Follow the steps in the readme.
I just tried with the latest 37.0.0 nuget. same message:
Would it be possible to have a better error message? Detailing why it is invalid ?
I saw some binding errors in the fusion log . ( using this tool https://github.com/awaescher/Fusion)

but I am not sure they are relevant. version 33.0.1 also shows similar errors.
goswinr commentedon Jul 1, 2021
With FCS 40.0 I still get the same
StopProcessingExnexception inFSharp.Compiler.Interactive.Shell.FsiEvaluationSession..ctor(..)in addition, the FSI error stream says:
however, I can't put Fsharp.Core in any of those directories because of insufficient user rights.
Is there any way to make the
FsiEvaluationSessionconstructor loadFSharp.Core.dllfrom the same location asFSharp.Compiler.Service.dll?@KevinRansom there is also no
app.configthat i could modify as suggested here #10467 (comment)goswinr commentedon Jul 2, 2021
After more than a year, I finally managed to fix this. 🎉
The constructor of
FsiEvaluationSessionqueries the current directory.However, when FCS is hosted in another app, this directory probably does not contain
FSharp.Core.dllin my case it isC:\Program Files\Rhino 7\System\So to fix this, I had to set the current directory to the location of
FSharp.Core.dllbefor callingFsiEvaluationSession.Create(...). I added:Directory.SetCurrentDirectory(Path.GetDirectoryName(Reflection.Assembly.GetAssembly([].GetType()).Location))Now it works !
JustinGrote commentedon Nov 17, 2023
Just a bump that I was bit by this while hosting the FCS compiler in .NET 8. @goswinr's workaround worked for me (thank you for your suffering)