OmniSharp / omnisharp-emacs

Troll coworkers - use Emacs at work for csharp!
GNU General Public License v3.0
514 stars 90 forks source link

`(void-variable it)` errors when starting omnisharp server with Emacs 28 native comp #521

Open Ruin0x11 opened 3 years ago

Ruin0x11 commented 3 years ago

This may be related to #516.

Using Emacs 28 with native compilation enabled, this error occurs when starting the server.

Debugger entered--Lisp error: (void-variable it)
  omnisharp--read-lines-from-process-output(#<process OmniServer<4>> "{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"N...")
  (let* ((messages-from-server (omnisharp--read-lines-from-process-output process message-part)) (error-message (concat "The server sent an unknown json message. " "Inspect the omnisharp-server process buffer " "to view recent messages from the server. " "Set `omnisharp-debug' to t and inspect the " "*omnisharp-debug* buffer for this error specifical...")) (json-messages (-map #'(lambda (json-string) (omnisharp--json-read-from-string json-string error-message)) messages-from-server))) (-map #'omnisharp--handle-server-event json-messages))
  omnisharp--handle-server-message(#<process OmniServer<4>> "{\"Event\":\"log\",\"Body\":{\"LogLevel\":\"INFORMATION\",\"N...")

If I add these lines to my config the error stops occurring.

(setq no-native-compile t
      load-no-native t)
razzmatazz commented 3 years ago

Hi @Ruin0x11 -- just noticed your issue on doom emacs :)

I just started running emacs28+nativecomp myself (albeit with lsp-mode) -- but will try to see what little fix can be done to aleviate this issue.

razzmatazz commented 3 years ago

Hmm, I could not replicate this issue on my mac with latest doom emacs. Do you have the latest omnisharp-emacs/doom installed? Do you have any specific project settings?

I installed server using M-x omnisharp-install-server and my test projects has succeeded in loading it.

jcs090218 commented 3 years ago

I think this is the problem from dash. Try reinstall it may work.

Ruin0x11 commented 3 years ago

Sorry, I had only noticed this repo was deprecated in favor of lsp-mode a short time ago. I thought it was still maintained because it came bundled with doom-emacs. I've since switched to using lsp-mode.

I should at least mention that I reinstalled dash and my entire Emacs system again, but those didn't fix the problem. I'm using Windows Server 2019.

I'll close this for now.

razzmatazz commented 3 years ago

I try to maintain this once a while to fix breakages, but no new features are planned.

CsBigDataHub commented 3 years ago

@razzmatazz any work around for this? Having the same issue on emacs28+nativecomp myself. I prefer this package to lsp for some feature like symbol-rename and jump to a definition imported from a .dll.

Thanks for your work and inputs.

razzmatazz commented 3 years ago

I managed to replicate this myself with emacs28+nativecomp. Running the code under non-nativecomp (regular) build apparently does NOT trigger the issue..

razzmatazz commented 3 years ago

@razzmatazz any work around for this? Having the same issue on emacs28+nativecomp myself. I prefer this package to lsp for some feature like symbol-rename and jump to a definition imported from a .dll.

Thanks for your work and inputs.

On a related note, @CsBigDataHub can you vouch for my PR https://github.com/OmniSharp/omnisharp-roslyn/pull/2079 where I am trying to merge in my changes so jump-to-definition-in-dll would work in LSP mode for omnisharp-roslyn? :) I can't get them to review/merge my PR so that one is stuck...

CsBigDataHub commented 3 years ago

@razzmatazz any work around for this? Having the same issue on emacs28+nativecomp myself. I prefer this package to lsp for some feature like symbol-rename and jump to a definition imported from a .dll.

Thanks for your work and inputs.

On a related note, @CsBigDataHub can you vouch for my PR https://github.com/OmniSharp/omnisharp-roslyn/pull/2079 where I am trying to merge in my changes so jump-to-definition-in-dll would work in LSP mode for omnisharp-roslyn? :) I can't get them to review/merge my PR so that one is stuck...

Sure, let me build the project with your PR and test it out. Will update soon.

benjamin-asdf commented 3 years ago

Btw I fixed this by adding (require 'dash) to every single file in the omnisharp project

razzmatazz commented 3 years ago

I have merged a PR that attempts to fix this issue with the change proposed by @rtnlmeme-DestroyerOfDeath -- will take some time to be updated to melpa.