omnisharp-roslyn: Incomplete/missing system API methods

I’m trying to manipulate some binary data represented as a hexadecimal string and I noticed that the language server incorrectly reports that some API methods do not exist. As a specific example (I have not had time to exhaustively go through all the API and see which are reported incorrectly) I would like to highlight Convert.ToHexString

To reproduce this problem:

  1. Start a new .NET 6 console application:
$ dotnet new console --framework net6.0
  1. Edit the generated Program.cs in emacs. Type just enough to get the autocomplete and syntax checkers to kick in:
using System;

byte[] bytes = new byte[] { 1, 2, 3, 4, 5 };
Convert.ToHexString(bytes);
  1. Note the syntax checker informing you that ToHexString is invalid: Screen Shot 2022-08-11 at 22 52 56

And that’s all there is to it. I am using emacs with an up-to-date omnisharp (verified by running M-x lsp-update-server) on macOS 12.5 (Monterey).

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (9 by maintainers)

Most upvoted comments

Yeah, that seems to be it. Here’s the function on disk:

(defcustom lsp-csharp-omnisharp-roslyn-download-url
  (concat "https://github.com/omnisharp/omnisharp-roslyn/releases/latest/download/"
          (cond ((eq system-type 'windows-nt)
                 ; On Windows we're trying to avoid a crash starting 64bit .NET PE binaries in
                 ; Emacs by using x86 version of omnisharp-roslyn on older (<= 26.4) versions
                 ; of Emacs. See https://lists.nongnu.org/archive/html/bug-gnu-emacs/2017-06/msg00893.html"
                 (if (and (string-match "^x86_64-.*" system-configuration)
                          (version<= "26.4" emacs-version))
                     "omnisharp-win-x64.zip"
                   "omnisharp-win-x86.zip"))

                ((eq system-type 'darwin)
                 "omnisharp-osx.zip")

                ((and (eq system-type 'gnu/linux)
                      (or (eq (string-match "^x86_64" system-configuration) 0)
                          (eq (string-match "^i[3-6]86" system-configuration) 0)))
                 "omnisharp-linux-x64.zip")

                (t "omnisharp-mono.zip")))
  "Automatic download url for omnisharp-roslyn."
  :group 'lsp-csharp-omnisharp
  :type 'string)

So I guess that’s pulling the wrong zip, and I guess that’s what I get for assuming lsp was up to date. Thanks for bearing with me through this mess.