Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

FsiEvaluationSession cant find Fsharp.Core when hosted in another process. #11770

Open

Description

@goswinr

Problem

The constructor of FsiEvaluationSession cant find Fsharp.Core when FCS is hosted in another process.
I used v40.0 but this problem probably existed since FCS 34.0. see #9064
When FCS is hosted in another app ( Rhino3d in my case) the directory at Directory.GetCurrentDirectory() in fsi.fs probably does not contain FSharp.Core.dll. A non-descriptive StopProcessingExn is raised.

The useful information about the problem is not in the exception, but only in the FSI error stream:

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\

Workaround

The workaround is to set the current directory to the location of FSharp.Core.dll before calling FsiEvaluationSession.Create(...)
for example via:
Directory.SetCurrentDirectory(Path.GetDirectoryName(Reflection.Assembly.GetAssembly([].GetType()).Location))
It took me one year, two other issues on this repo, and the reading of the now more descriptive FSI error stream (since 40.0) in addition to the exception, to understand what the problem was and find this workaround.

Activity

  1. added
    Impact-Medium
    on Jul 7, 2021
  2. added this to the Backlog milestone on Sep 21, 2022
  3. JustinGrote commented on Nov 17, 2023

    @JustinGrote

    Can this be cheated with an assemblyloadcontext or assemblycontexthandler?

  4. goswinr commented on Dec 17, 2023

    @goswinr
    ContributorAuthor

    @JustinGrote Thanks for thinking about this. It seems that not so many people are hosting FSI. Would I have to use the AssemblyLoadContext for hosting FCS and FSI ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-FCSBugImpact-Medium

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions