fsharp / emacs-fsharp-mode

F# Emacs mode
Apache License 2.0
208 stars 61 forks source link

Fails loading project created with "dotnet new classlib -lang f#" #204

Open kqr opened 5 years ago

kqr commented 5 years ago

Description

I cannot get fsharp-mode to load any project file: the simplest I've tried so far has been the one generated by dotnet new classlib -lang f# which also fails.

Repro steps

(1) Create a directory with the following two files:

Library.fs:

namespace fsharp_mode_repro

module Say =
    let hello name =
        printfn "Hello %s" name

fsharp_mode_repro.fsproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <RootNamespace>fsharp_mode_repro</RootNamespace>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Library.fs" />
  </ItemGroup>

</Project>

(2) Open Library.fs in Emacs.

(3) For good measure, press C-c C-p and navigate to the fsharp_mode_repro.fsproj file, and press RET.

Expected behavior

I expect the project file to be loaded.

Actual behavior

My message buffer gets a stack trace:

Unexpected internal error. Please report at https://github.com/fsharp/FsAutoComplete/issues, attaching the exception information:
System.InvalidOperationException: object_op ---> System.EntryPointNotFoundException: SystemNative_RealPath
  at (wrapper managed-to-native) Interop+Sys.RealPath(string)
  at System.IO.CoreFX.FileSystemWatcher+RunningInstance.Start () [0x00000] in <e9297c7c5cde4e1285346aced9ff2658>:0 
  at System.IO.CoreFX.FileSystemWatcher.StartRaisingEvents () [0x00067] in <e9297c7c5cde4e1285346aced9ff2658>:0 
  at System.IO.CoreFX.FileSystemWatcher.StartRaisingEventsIfNotDisposed () [0x00019] in <e9297c7c5cde4e1285346aced9ff2658>:0 
  at System.IO.CoreFX.FileSystemWatcher.set_EnableRaisingEvents (System.Boolean value) [0x0001d] in <e9297c7c5cde4e1285346aced9ff2658>:0 
  at (wrapper remoting-invoke-with-check) System.IO.CoreFX.FileSystemWatcher.set_EnableRaisingEvents(bool)
  at System.IO.CoreFXFileSystemWatcherProxy+<>c.<StartDispatching>b__9_0 (System.IO.CoreFX.FileSystemWatcher internal_fsw, System.IO.FileSystemWatcher fsw) [0x00048] in <e9297c7c5cde4e1285346aced9ff2658>:0 
  at System.IO.CoreFXFileSystemWatcherProxy.Operation (System.Action‘4[T1,T2,T3,T4] map_op, System.Action‘2[T1,T2] object_op, System.Object handle, System.Action‘2[T1,T2] cancel_op) [0x00184] in <e9297c7c5cde4e1285346aced9ff2658>:0 
   --- End of inner exception stack trace ---
  at System.IO.CoreFXFileSystemWatcherProxy.Operation (System.Action‘4[T1,T2,T3,T4] map_op, System.Action‘2[T1,T2] object_op, System.Object handle, System.Action‘2[T1,T2] cancel_op) [0x001a6] in <e9297c7c5cde4e1285346aced9ff2658>:0 
  at System.IO.CoreFXFileSystemWatcherProxy.StartDispatching (System.Object handle) [0x00004] in <e9297c7c5cde4e1285346aced9ff2658>:0 
  at System.IO.FileSystemWatcher.Start () [0x0001b] in <e9297c7c5cde4e1285346aced9ff2658>:0 
  at System.IO.FileSystemWatcher.set_EnableRaisingEvents (System.Boolean value) [0x0003d] in <e9297c7c5cde4e1285346aced9ff2658>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileSystemWatcher.set_EnableRaisingEvents(bool)
  at FsAutoComplete.Project..ctor (System.String projectFile, Microsoft.FSharp.Core.FSharpFunc‘2[T,TResult] onChange) [0x000e2] in <59ba4889f78c97f6a74503838948ba59>:0 
  at <StartupCode$FsAutoComplete-Core>.$Commands+project@106-1.Invoke (Microsoft.FSharp.Core.Unit _arg1) [0x00001] in <59ba4889f78c97f6a74503838948ba59>:0 
  at <StartupCode$FsAutoComplete-Core>.$Commands+Project@103.Invoke (Microsoft.FSharp.Core.Unit unitVar) [0x00043] in <59ba4889f78c97f6a74503838948ba59>:0 
  at Microsoft.FSharp.Control.AsyncBuilderImpl+callA@851[b,a].Invoke (Microsoft.FSharp.Control.AsyncParams‘1[T] args) [0x00047] in <561d4e1d904cf4daa74503831d4e1d56>:0 

Known workarounds

I wish!

Related information

kqr commented 5 years ago

This is an issue with FSAC on OS X when running under Mono installed from Homebrew – but not if Mono is installed from www.mono-project.com! Crazy!

There is a corresponding issue in the FSAC repo: https://github.com/fsharp/FsAutoComplete/issues/331

And for the Homebrew distributed Mono: https://github.com/Homebrew/homebrew-core/issues/40138

kqr commented 5 years ago

To be clear: the best workaround I have found so far is to install Mono from www.mono-project.com instead of Homebrew.