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

Debugging on Apple Silicon M1 with Visual Studio for Mac or JetBrains Rider Hangs #2303

Closed
ilushka85 opened this issue Nov 19, 2020 · 18 comments
Milestone

Comments

@ilushka85
Copy link

When using Apple Silicon m1 Processor starting a debug session in Rider or Visual Studio for Mac hangs at the following console output:

Visual Studio for Mac:

Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/3.1.9/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

JetBrains Rider:

/Applications/Rider.app/Contents/lib/ReSharperHost/macos-x64/dotnet/dotnet exec /Applications/Rider.app/Contents/lib/ReSharperHost/JetBrains.Debugger.Worker.exe --mode=client --frontend-port=52885 --plugins=/Applications/Rider.app/Contents/plugins/rider-unity/dotnetDebuggerWorker

Loaded application domain 'DefaultDomain (id 1)'
Loaded Assembly '/Library/Application Support/AzureFunctions/System.Private.CoreLib.dll'
Loading module /Library/Application Support/AzureFunctions/System.Private.CoreLib.dll in application domain 1:DefaultDomain
Pdb file for assembly /Library/Application Support/AzureFunctions/System.Private.CoreLib.dll was not found or failed to read

Running without debugging works normally, but debugging is not currently possible because of this.

@anthonychu
Copy link
Member

Are you able to create and debug an ASP.NET Core app with VS for Mac? Just want to understand if the problem is specifically with debugging function apps.

@ilushka85
Copy link
Author

Yes asp.net core web app debugs fine in both vs and rider. This is just an issue in debugging azure functions.

@anthonychu
Copy link
Member

@ilushka85 I don’t think anyone on our team has been lucky enough to get their hands on one of these new devices. Do you have more details on the error that you can share? For instance, I believe in your original issue you mentioned an error about the debugger being used outside of visual studio products. Is that still the problem? Have you tried it with VS Code? Thanks.

@ilushka85
Copy link
Author

This is only a problem for Azure Functions. Debugging regular .net core web apps works fine. Running Azure Functions without debugger works fine. Debugging is an issue in both Rider and Visual Studio for Mac.

Is there something I can do to produce more details? Happy to help any way I can

@anthonychu
Copy link
Member

Can you provide more of the console output? Also if you can confirm whether you get the same problem in VS Code, it would be helpful. Thanks.

@ilushka85
Copy link
Author

Thats actual the entire console output it does not go any further and believes its running. CPU usage shows 100% for the Func app. Will try on vs code

@ilushka85
Copy link
Author

Same result in all systems.

@haydenbaer
Copy link

I just bought a MacBook Pro M1 today and immediately faced the same issue when debugging a Razer Pages Web Application. I use Safari to debug and it worked no problem on my Intel 2020 MacBook Air. After reinstalling many times and ensuring everything is up to date it sticks on the exact same line when debugging.
"Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/3.1.9/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled." is the only line that loads and then the output stops. Nothing seems to fix the issue, I'll try some more and see what I can get out of it.

@ilushka85
Copy link
Author

Anyone have any ideas why this is stuck in Rosetta 2 but regular app debugging works?

@cdasso
Copy link

cdasso commented Nov 24, 2020

For my .net core apps I can run without debugging but when debugging always stops after the first Loading line as described above

@anthonychu
Copy link
Member

@cdasso Can you please confirm if this is a .NET Core functions app or another type of .NET Core app?

@rootdevelop
Copy link

Same here, running in debug doesn't work for any of my asp.net core (3.1) or console applications. Output doesn't go further then "Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/3.1.9/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.".

When creating a new .net 5.0 asp net core mvc application it crashes with the following message after trying to start in debug:

Loaded '/usr/local/share/dotnet/shared/Microsoft.NETCore.App/5.0.0/System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Stack overflow. at System.Collections.HashHelpers.GetPrime(Int32) at System.Collections.Generic.Dictionary2[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Initialize(Int32)
at System.Collections.Generic.Dictionary2[[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]..ctor(Int32, System.Collections.Generic.IEqualityComparer1<System.__Canon>)
at System.AppContext.Setup(Char**, Char**, Int32)
`

@cdasso
Copy link

cdasso commented Nov 24, 2020 via email

@jmatthiesen
Copy link

Hey there – I work on the Visual Studio for Mac team. We've been tracking an issue with debugging .NET Core applications on the M1 processor. There's a bug fix coming with the 11.2 release of Big Sur, which is in beta now, and with that it fixes the issue – I confirmed on my own M1 device just today. We'll update our issue tracker once 11.2 is released.

@jkryspin
Copy link

Hey @jmatthiesen,

I encountered this same issue. I upgraded to 11.2 Big Sur and I can now debug in Visual Studio.
Seems to be fixed. Thanks so much!

@gieseking
Copy link

I'm on Big Sur 11.6 and still encounter this issue. I can run the azure functions reliably, but shortly after attaching to the process with the debugger in vs code the functions lock up and the func process has to be force quit. Sometimes I can hit a breakpoint but shortly after stopping on the first breakpoint the function host will lock up.

@egieseking
Copy link

For those coming to this page looking for a possible solution I am posting what is now working well for me after trying many combinations of .NET core, azure function core tools, and IDEs (both x64/Rosetta and arm64 versions). Almost all scenarios resulted in being able to execute the azure functions, but the azure functions would run very slowly and eventually completely lock up azure function core tools shortly after attaching a debugger to the process.

I now have .NET CORE SDK 3.1.414, .NET CORE SDK 2.1.818, Azure Function Core tools 2.7.3188, and Visual Studio for Mac community v 8.10.11 (build 8).
With this setup I still cannot reliably debug the functions project when starting from the IDE (probably because visual studio is still starting them with Azure Function Core tools 3.0.2358).
However, I can start the the functions from the command line using core tools 2.7.3188 (func start host), and then once running attach to the process in Visual Studio for Mac. I have been using this method for the last couple of days and the functions run much faster than they did using Azure Function Core Tools 3 and I can reliably debug and stop at breakpoints without the functions or the IDE locking up.

@ejizba
Copy link
Contributor

ejizba commented Nov 18, 2021

Consolidating M1 issues. Sounds like the root problem for this issue was fixed as of this comment: #2303 (comment). For general M1 support (we know there are still problems), we will use #2834 for tracking going forward

@ejizba ejizba closed this as completed Nov 18, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Dec 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants