hangs when using .NET SDK Arm64 (Apple M1)
Hello! Possibly related to https://github.com/razzmatazz/csharp-language-server/issues/33.
I had to install the x64 distributions of the .NET SDK for things to work. It was weird because csharp-ls was not crashing when I ran it from the CLI, but it would hang in Emacs.
Once the x64 is installed, don't forget to reconfigure the DOTNET_ROOT environment variable to /usr/local/share/dotnet/x64 in Emacs.
Hey. I am coding on M1 too, IIRC things should just work on latest (28.2+ish emacs)
What is your version of emacs, lsp client (lsp-mode or eglot?), distribution (doom/spacemacs/something else?)
Have you installed arm64 version of dotnet-core? Or both (x64+arm64?) Which version(s) of runtime/SDKs do you have installed?
(Sorry for replying this late)
Hey, I'm running lsp-mode and spacemacs (emacs 28.2). I couldn't get it to work when I strictly only had the arm64 version (dotnet 6 and 7). I got it to work in the end by having only x64 distributions.
What dotnet distributions are you running?
could you do a "dotnet stack report -p
personally i wqs using dotnet-7.0.1 but don't have access to the pc ATM. it was working with dotnet6 sdks on m1 too
There's no dotnet-stack for the arm64 release on M1 :(
There's no dotnet-stack for the arm64 release on M1 :(
are you sure? because it is working for me..
bob@mbp ~ % dotnet stack --version
6.0.328102+ab657cc109f93e48d52f6b12cd7f136bb2d0b311
bob@mbp ~ % ps ax | grep -i CSharp
41868 ?? Ss 0:30.39 /Users/bob/src/csharp-language-server/src/CSharpLanguageServer/bin/Debug/net7.0/CSharpLanguageServer -s src/solution.sln
42144 s003 U+ 0:00.00 grep -i CSharp
bob@mbp ~ % ps ax | grep -i CSharp
41868 ?? Ss 0:31.77 /Users/bob/src/csharp-language-server/src/CSharpLanguageServer/bin/Debug/net7.0/CSharpLanguageServer -s src/solution.sln
42245 s003 R+ 0:00.00 grep -i CSharp
bob@mbp ~ % dotnet stack report -p41868
Thread (0x4C0D1B):
[Native Frames]
System.Private.CoreLib!System.Threading.ManualResetEventSlim.Wait(int32,value class System.Threading.CancellationToken)
System.Private.CoreLib!System.Threading.Tasks.Task.SpinThenBlockingWait(int32,value class System.Threading.CancellationToken)
System.Private.CoreLib!System.Threading.Tasks.Task.InternalWaitCore(int32,value class System.Threading.CancellationToken)
System.Private.CoreLib!System.Threading.Tasks.Task.Wait(int32,value class System.Threading.CancellationToken)
System.Private.CoreLib!System.Threading.Tasks.Task.WaitAnyCore(class System.Threading.Tasks.Task[],int32,value class System.Threading.CancellationToken)
System.Private.CoreLib!System.Threading.Tasks.Task.WaitAny(class System.Threading.Tasks.Task[])
Ionide.LanguageServerProtocol!Ionide.LanguageServerProtocol.Server.startWithSetup(class Microsoft.FSharp.Core.FSharpFunc`2<!!0,class Microsoft.FSharp.Collections.FSharpMap`2<class System.String,class System.Delegate>>,class System.IO.Stream,class System.IO.Stream,class Microsoft.FSharp.Core.FSharpFunc`2<class System.Tuple`2<class Microsoft.FSharp.Core.FSharpFunc`2<class System.String,class Microsoft.FSharp.Core.FSharpFunc`2<class System.Object,class Microsoft.FSharp.Control.FSharpAsync`1<value class Microsoft.FSharp.Core.FSharpResult`2<class Microsoft.FSharp.Core.Unit,class Error>>>>,class ClientRequestSender>,!!0>,class Microsoft.FSharp.Core.FSharpFunc`2<class StreamJsonRpc.IJsonRpcMessageHandler,class StreamJsonRpc.JsonRpc>)
CSharpLanguageServer!CSharpLanguageServer.Server.startCore(class Options)
CSharpLanguageServer!CSharpLanguageServer.Server.start(class Options)
CSharpLanguageServer!CSharpLanguageServer.Program.entry(class System.String[])
Thread (0x4C0D2D):
[Native Frames]
System.Private.CoreLib!System.Threading.WaitHandle.WaitOneNoCheck(int32)
System.Private.CoreLib!System.Threading.PortableThreadPool+GateThread.GateThreadStart()
(...)
oh.. you need to install/update this tool manually, it is not bundled with .net core installation
bob@mbp ~ % dotnet tool install --global dotnet-stack
Ah, I tried that actually and it was complaining I did not have the x64 architecture and the documentation doesn't include arm64 as a download option:
You must install .NET to run this application.
App: /Users/august.feng/.dotnet/tools/dotnet-stack
Architecture: x64
App host version: 7.0.2
.NET location: Not found
Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed
Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=osx.13-x64&apphost_version=7.0.2
But, dotnet tool install --global dotnet-stack -a arm64 gets me an arm64 version! :)
The dump:
dotnet stack report -p 41682
Thread (0x187539):
[Native Frames]
System.Private.CoreLib!System.Threading.ManualResetEventSlim.Wait(int32,value class System.Threading.CancellationToken)
System.Private.CoreLib!System.Threading.Tasks.Task.SpinThenBlockingWait(int32,value class System.Threading.CancellationToken)
System.Private.CoreLib!System.Threading.Tasks.Task.InternalWaitCore(int32,value class System.Threading.CancellationToken)
System.Private.CoreLib!System.Threading.Tasks.Task.Wait(int32,value class System.Threading.CancellationToken)
System.Private.CoreLib!System.Threading.Tasks.Task.WaitAnyCore(class System.Threading.Tasks.Task[],int32,value class System.Threading.CancellationToken)
System.Private.CoreLib!System.Threading.Tasks.Task.WaitAny(class System.Threading.Tasks.Task[])
Ionide.LanguageServerProtocol!Ionide.LanguageServerProtocol.Server.startWithSetup(class Microsoft.FSharp.Core.FSharpFunc`2<!!0,class Microsoft.FSharp.Collections.FSharpMap`2<class System.String,class System.Delegate>>,class System.IO.Stream,class System.IO.Stream,class Microsoft.FSharp.Core.FSharpFunc`2<class System.Tuple`2<class Microsoft.FSharp.Core.FSharpFunc`2<class System.String,class Microsoft.FSharp.Core.FSharpFunc`2<class System.Object,class Microsoft.FSharp.Control.FSharpAsync`1<value class Microsoft.FSharp.Core.FSharpResult`2<class Microsoft.FSharp.Core.Unit,class Error>>>>,class ClientRequestSender>,!!0>,class Microsoft.FSharp.Core.FSharpFunc`2<class StreamJsonRpc.IJsonRpcMessageHandler,class StreamJsonRpc.JsonRpc>)
CSharpLanguageServer!CSharpLanguageServer.Server.startCore(class Options)
CSharpLanguageServer!CSharpLanguageServer.Program.entry(class System.String[])
Thread (0x18755C):
[Native Frames]
System.Private.CoreLib!System.Threading.WaitHandle.WaitOneNoCheck(int32)
System.Private.CoreLib!System.Threading.PortableThreadPool+GateThread.GateThreadStart()
System.Private.CoreLib!System.Threading.Thread.StartCallback()
Thread (0x18755F):
[Native Frames]
?!?
System.Console!Interop+Sys.Read(class System.Runtime.InteropServices.SafeHandle,unsigned int8*,int32)
System.Console!System.ConsolePal.Read(class Microsoft.Win32.SafeHandles.SafeFileHandle,value class System.Span`1<unsigned int8>)
System.Console!System.IO.ConsoleStream.Read(unsigned int8[],int32,int32)
System.Private.CoreLib!System.IO.Stream+<>c.<BeginReadInternal>b__38_0(class System.Object)
System.Private.CoreLib!System.Threading.Tasks.Task`1[System.Int32].InnerInvoke()
System.Private.CoreLib!System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(class System.Threading.Thread,class System.Threading.ExecutionContext,class System.Threading.ContextCallback,class System.Object)
System.Private.CoreLib!System.Threading.Tasks.Task.ExecuteWithThreadLocal(class System.Threading.Tasks.Task&,class System.Threading.Thread)
System.Private.CoreLib!System.Threading.ThreadPoolWorkQueue.Dispatch()
System.Private.CoreLib!System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
System.Private.CoreLib!System.Threading.Thread.StartCallback()
Thread (0x18756F):
[Native Frames]
?!?
System.Net.Sockets!System.Net.Sockets.SocketAsyncEngine.EventLoop()
System.Private.CoreLib!System.Threading.Thread.StartCallback()