emacs-fsharp-mode
emacs-fsharp-mode copied to clipboard
Fails loading project created with "dotnet new classlib -lang f#"
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>[email protected] (Microsoft.FSharp.Core.Unit _arg1) [0x00001] in <59ba4889f78c97f6a74503838948ba59>:0
at <StartupCode$FsAutoComplete-Core>[email protected] (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
- Operating system: OS X 10.14.1
- Branch: ...elpa?
- Emacs version: GNU Emacs 26.1 (build 1, x86_64-apple-darwin14.5.0, NS appkit-1348.17 Version 10.10.5 (Build 14F2511)) of 2018-05-31
- .NET Core SDK version: 2.2.103, host version: 3.0.0-preview-27324-5 – but F# support given through Mono, version: Microsoft (R) F# Compiler version 10.2.3 for F# 4.5
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
To be clear: the best workaround I have found so far is to install Mono from www.mono-project.com instead of Homebrew.