Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FsAutoComplete (mono) raise an exception after first request #254

Open
thomashilke opened this issue Nov 17, 2020 · 1 comment
Open

FsAutoComplete (mono) raise an exception after first request #254

thomashilke opened this issue Nov 17, 2020 · 1 comment

Comments

@thomashilke
Copy link

Description

When I run M-x eglot in a buffer where fsharp-mode is enabled, an zip archive containing the FsAutoComplete distribution files is downloaded and unpackaged into ~/.emacs.d/FsAutoComplete. Then eglot start the LSP server by running the equivalent of mono /home/.../.emacs.d/.emacs.d/FsAutoComplete/netframework/fsautocomplete.exe --background-service-enabled. This last command is returned by eglot-fsharp.

After the connection is established, the request

(:jsonrpc "2.0" :id 1 :method "initialize" :params
          (:processId 22044 :rootPath "/home/.../test/" :rootUri "file:///home/.../test/" :initializationOptions
                      (:automaticWorkspaceInit t)
                      :capabilities
                      (:workspace
                       (:applyEdit t :executeCommand
                                   (:dynamicRegistration :json-false)
                                   :workspaceEdit
                                   (:documentChanges :json-false)
                                   :didChangeWatchedFiles
                                   (:dynamicRegistration t)
                                   :symbol
                                   (:dynamicRegistration :json-false)
                                   :configuration t)
                       :textDocument
                       (:synchronization
                        (:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
                        :completion
                        (:dynamicRegistration :json-false :completionItem
                                              (:snippetSupport t)
                                              :contextSupport t)
                        :hover
                        (:dynamicRegistration :json-false :contentFormat
                                              ["markdown" "plaintext"])
                        :signatureHelp
                        (:dynamicRegistration :json-false :signatureInformation
                                              (:parameterInformation
                                               (:labelOffsetSupport t)))
                        :references
                        (:dynamicRegistration :json-false)
                        :definition
                        (:dynamicRegistration :json-false)
                        :declaration
                        (:dynamicRegistration :json-false)
                        :implementation
                        (:dynamicRegistration :json-false)
                        :typeDefinition
                        (:dynamicRegistration :json-false)
                        :documentSymbol
                        (:dynamicRegistration :json-false :symbolKind
                                              (:valueSet
                                               [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26]))
                        :documentHighlight
                        (:dynamicRegistration :json-false)
                        :codeAction
                        (:dynamicRegistration :json-false :codeActionLiteralSupport
                                              (:codeActionKind
                                               (:valueSet
                                                ["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "sour\
ce.organizeImports"])))
                        :formatting
                        (:dynamicRegistration :json-false)
                        :rangeFormatting
                        (:dynamicRegistration :json-false)
                        :rename
                        (:dynamicRegistration :json-false)
                        :publishDiagnostics
                        (:relatedInformation :json-false))
                       :experimental nil)))

is forwarded to the LSP server (as shown in the buffer *EGLOT (test/fsharp-mode) events*), and the server respond with the following error:

[server-reply] (id:1) ERROR Tue Nov 17 13:51:44 2020:
(:jsonrpc "2.0" :id 1 :error
          (:code -32603 :message "System.TypeInitializationException: The type initializer for
'Microsoft.Data.Sqlite.SqliteConnection' threw an exception. --->
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. ---> System.DllNotFoundException:
e_sqlite3 assembly:<unknown assembly> type:<unknown type>
member:(null)\n  at (wrapper managed-to-native)
SQLitePCL.SQLite3Provider_e_sqlite3+NativeMethods.sqlite3_libversion_number()\n
at
SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number
() [0x00000] in <60b9636eddae467abf835d7bde5925d6>:0 \n  at
SQLitePCL.raw.SetProvider (SQLitePCL.ISQLite3Provider imp) [0x00008]
in <4a65135bb20943459d36511273e609dc>:0 \n  at
SQLitePCL.Batteries_V2.Init () [0x00005] in
<635106fb54074b6697e6f94014d8533a>:0 \n  at (wrapper
                                             managed-to-native)
System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)\n
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj,
                                                             System.Reflection.BindingFlags
                                                             invokeAttr,
                                                             System.Reflection.Binder
                                                             binder,
                                                             System.Object[]
                                                             parameters,
                                                             System.Globalization.CultureInfo
                                                             culture)
[0x0007c] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 \n   --- End of
inner exception stack trace ---\n  at
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj,
                                                          System.Reflection.BindingFlags
                                                          invokeAttr,
                                                          System.Reflection.Binder
                                                          binder,
                                                          System.Object[]
                                                          parameters,
                                                          System.Globalization.CultureInfo
                                                          culture)
[0x0009a] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 \n  at
System.Reflection.MethodBase.Invoke (System.Object obj,
                                                   System.Object[]
                                                   parameters)
[0x00000] in <12b418a7818c4ca0893feeaaf67f1e7f>:0 \n  at
Microsoft.Data.Sqlite.Utilities.BundleInitializer.Initialize ()
[0x0002f] in <b46e232ade014524baa458345f270c50>:0 \n  at
Microsoft.Data.Sqlite.SqliteConnection..cctor () [0x00000] in
<b46e232ade014524baa458345f270c50>:0 \n   --- End of inner exception
stack trace ---\n  at (wrapper managed-to-native)
System.Object.__icall_wrapper_mono_generic_class_init(intptr)\n  at
SymbolCache+PersistenCacheImpl.initializeCache (System.String dir)
[0x00049] in <56a19b898b41d0b0a931c1ad7999f115>:0 \n  at
FsAutoComplete.Commands`1[analyzer].StartBackgroundService
(Microsoft.FSharp.Core.FSharpOption`1[T] workspaceDir) [0x00016] in
<56a19b898b41d0b0a931c1ad7999f115>:0 \n  at
[email protected] (Microsoft.FSharp.Core.Unit
                                          unitVar) [0x00033] in
<c54a29a614138c8bdb825198c178886d>:0 \n  at
Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult]
(Microsoft.FSharp.Control.AsyncActivation`1[T] ctxt, TResult result1,
                                           Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]
                                           part2) [0x00005] in
<039b17603f7a807e0eeaa652dc64c784>:0 \n  at
Microsoft.FSharp.Control.Trampoline.Execute
(Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] firstAction) [0x00020]
in <039b17603f7a807e0eeaa652dc64c784>:0 "))

(roughly reformatted for lisibility), and then the server crashes. Note that the foder ~/.emacs.d/FsAutoComplete/netframework/ contains e_sqlite3.dll, as well as SQLitePCLRaw.provider.e_sqlite3.dll.

Repro steps

  1. Given the relevent configuration in ~/.emacs.d/init.el given below, open a .fs file.

Expected behavior

FsAutoComplete.exe should start successfully, and not crash, failing to load a DLL related to e_sqlite3.dll.

Actual behavior

FsAutoComplete.exe raise an exception while handling the first json-rpc request it receive. Error message talks about System.DllNotFoundException: e_sqlite3. The error message fills the minibuffer.

Known workarounds

None that I know of.

Related information

  • Operating system: Ubuntu 20.04, running in WSL on Windows 10.0
  • Eglot version: 1.6
  • FsAutoComplete version: FsAutoComplete 0.41.1 (git sha 7016e936b45e0354323a7d8f153f64f14522c054)
  • Emacs version: GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14) of 2020-03-26, modified by Debian
  • Relevent part of .emacs.d/init.el:
     (require 'fsharp-mode)
     (require 'eglot-fsharp)
     (add-hook 'fsharp-mode-hook #'eglot-ensure)
     (setq inferior-fsharp-program "/usr/bin/fsharpi --readline-")
    
  • .NET Runtime, CoreCLR or Mono Version:
Mono JIT compiler version 6.8.0.105 (Debian 6.8.0.105+dfsg-2 Wed Feb 26 23:23:50 UTC 2020)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        Interpreter:   yes
        LLVM:          supported, not enabled.
        Suspend:       hybrid
        GC:            sgen (concurrent by default)
@juergenhoetzel
Copy link
Collaborator

This is a known issue on Mono. I reported it upstream some time ago: ionide/FsAutoComplete#448

Mono is considered unsupported (for fsautocomplete). Upstream quote

FsAutoComplete can run on .NET/mono or .NET Core. We highly recommend using .Net Core version of FSAC as we plan to remove "full framework" version soon - read more

We should remove Mono support in eglot-fsharp to prevent starting a broken LSP-server in the first place.

@juergenhoetzel juergenhoetzel changed the title FsAutoComplete raise an exception after first request FsAutoComplete (mono) raise an exception after first request Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants