In VSMac, we are using vsdbg
(same as Omnisharp) to debug .NET Core applications... We have unit tests, but ever since bumping XCode from 11 to 12, debugging started failing... So here are repro steps:
1) sudo xcode-select -s /Applications/Xcode_12.app
2) mkdir xcodeTestProj
3) cd xcodeTestProj
4) dotnet new console
5) dotnet publish --runtime osx-x64
5) code .
6) create launch.json
via VSCode, and change:
"program": "${workspaceFolder}/bin/Debug/net5.0/xcodeTestProj.dll",
"program": "${workspaceFolder}/bin/Debug/net5.0/osx-x64/publish/xcodeTestProj.dll",
Unable to attach to CoreCLR. Unknown Error: 0x80131c3c
Now try all steps, but change step 1 to sudo xcode-select -s /Applications/Xcode_11.app
(notice change of Xcode version), it will work fine.
I tried to change to not use published version... But when tests are executing they fail either wrong variables values are reported or “Unable to evaluate expression because the code is optimized o...”.(Only when using XCode 12, fine with XCode 11). I believe underlining problem is same, hence I suggest trying debugging published app since its easier repro...
Im not sure how is selecting XCode 12 vs 11 effecting debugging of CoreCLR, but it does, I suspect its something related to lldb
or some libraries used...
No.
We have to disable .NET Core unit tests for until this is resolved, but I also believe this will effect users when doing some complex debugging.
Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.
@hoyosjs
FYI @caslan
Looks like we may be seeing some customers running into this problem when debugging in VS Mac with Xcode 12 installed.
https://developercommunity.visualstudio.com/content/problem/1190334/unable-to-attach-to-coreclr-unknown-error-0x80131c.html - Xcode 12 being used here.
I can confirm this workaround.
Xcode_11
cd /
sudo xcode-select -s /Applications/Xcode_11.app
Now everything works for me.
Thanks!
Download Xcode
The direct link to the Xcode 11.7 file didn't work for me.
In case anyone else is having trouble, go to Apple's More Downloads for Apple Developers page and search Xcode 11.7
👍
Hi @tommcdon @hoyosjs,
Im wonder how could priority on this be increased so someone takes a look at this since more and more developers will start switching to XCode 12 since it was released last week, and milestone .NET 6 feels too far away... At first I though this would only be problem for unit tests but looks like its effecting also developers...
Regards,
David
@c-lamont and @brminnick solution worked for me as a workaround as well. Just to mention, my initial workaround was to Dockerize my .NET core app and run it in a Linux container. Just in case the above workaround does not work for others out there.
@DavidKarlas the milestone means that it will be completed in master first. If there's enough customer feedback, we take it to ship room for backport approval. I can imagine this fitting the requirements easily.
And sorry for the time it's taken me. I've had an avalanche of issues coming in and I tried getting XCode 12, but my Mac seems... a little hesitant to help here. With all of us working from home, I haven't been able to access a different device. I'll see if a teammate can help me out to repro this.
@hoyosjs Tnx for explaining, I just thought that milestone means it will have to wait few months... If you want me to do some testing/debugging let me know.
Re workaround:
It seems that downloading and installing the "Command Line Developer Tools for Xcode 11.5" (*.dmg
, contains an installer package (*.pkg
), about 260MB) from https://developer.apple.com/download/more/ is sufficient (no need for Xcode 11 as a whole).
Once installed, switch to this version of the tools with sudo xcode-select -s /Library/Developer/CommandLineTools
Re workaround:
It seems that downloading and installing the "Command Line Developer Tools for Xcode 11.5" (
*.dmg
, contains an installer package (*.pkg
), about 260MB) from https://developer.apple.com/download/more/ is sufficient (no need for Xcode 11 as a whole).Once installed, switch to this version of the tools with
sudo xcode-select -s /Library/Developer/CommandLineTools
Works like a charm in OSX 10.15.7, VS Studio 2019
Re workaround:
It seems that downloading and installing the "Command Line Developer Tools for Xcode 11.5" (
*.dmg
, contains an installer package (*.pkg
), about 260MB) from https://developer.apple.com/download/more/ is sufficient (no need for Xcode 11 as a whole).Once installed, switch to this version of the tools with
sudo xcode-select -s /Library/Developer/CommandLineTools
Also fixes the issue on Rider for me as well.
This is most likely fixed by https://github.com/dotnet/runtime/pull/42900
I upgraded Xcode to the new version 12.1 and now the debugger is busted. Not to mention in the simulator the perform segue goes to the view controller but the view doesn't render. Worked before the update and works on my phone. Also, the date picker is coming up different in the simulator.
Hi, I'm experiencing this bug since I updated my XCode to 12 (now 12.1). Would it affect my mobile app builds if I install the build tools for XCode 11? It's frustrating to not be able to debug code in Rider and Visual Studio.
Hi, I'm experiencing this bug since I updated my XCode to 12 (now 12.1). Would it affect my mobile app builds if I install the build tools for XCode 11? It's frustrating to not be able to debug code in Rider and Visual Studio.
This is related to the tools that are installed on the machine that's running the app under the debugger. We used to rely on vmmap
, which was updated in a way that broke our usage. It's only used in debugging scenarios. There was a contribution to fix this for .NET 6 (master), but it needs to be ported to other releases. As I get feedback of it affecting users I can justify getting it backported.
cc: @gregg-miskelly the affected API needed for this lives in the PAL and is only really used through dbgshim (apis like CreateVersionStringFromModule and EnumerateCLRs).
cc: @tommcdon
Thanks @hoyosjs . It's manageable for the meantime debugging code only through Console.WriteLine
. As long Running without Debugging
doesn't break anytime soon.
But it would really be great to have this fixed and be able to debug code normally again.
@kuromukira you can use the workarounds posted above to debug normally. Using an older copy of Xcode. Its pretty easy to switch back and forth if you also do other things with Xcode 12.
@hoyosjs after upgrading to Big Sur I'm unable to use the workaround, so a back port of the fix would be helpful.
I have the same issue as @8or15.
Here the error if you try to install the Command Line Tools 11.5:
Command Line Tools 11.5 can't be installed on the disk. The version of macOS is too new.
@hoyosjs
Please back port the fix to .NET Core 3 and .NET 5.
- .NET Core SDK 3.1.404 (Commit: 470f6754b3)
- macOS: 11.0.1 (20B29) - Darwin 20.1.0
- Xcode
Version: 12.2 (12B45b)
Xcode: 12.2 (17535)
Instruments: 12.2 (64541.11)
- CommandLineToolsForXcode: 2384 (via xcode-select --version)
I was experiencing the same issue before and the fix did it for me. But after updating to BigSur
and with Visual Studio Version 1.51.1 doesn't work anymore. Anybody else experiencing this?
And also the same issue when trying to install Command Line Tools 11.5.
I had to downgrade back to macOS Catalina 10.15.7 (19H2) and the Command Line Developer Tools for Xcode 11.5 (version 2373). Currently, that is the only way I can be productive on .NET Core 3.1
@mikem8361 has started the discussions for the backport in #44748
None of the solutions work for me on Big Sur 😢
The fix had been merged in time to make it into our next official build. After that it needs to be picked up by the different debuggers in the ecosystem. VS for mac and VSCode use the same debugger engine and the owners expressed interest in including the fix as soon as possible.
@hoyosjs Looks like it was backported to .NET 5. Does the issue affect .NET 2.1 and/or .NET 3.1? Are those backports being requested too?
@sdmaclea Because this is a dbgshim fix - it doesn't need to be. Any debugger that wants this fix can use the .NET 5 dbgshim.
Ran a test of this fix and it looks good to me with Xcode 12.2.
I am assuming there will be a more official debugger zip at some point with this updated libdbgshim.dylib that can be bundled with OmniSharp and VS Mac?
@wingchunninja Sorry, I was testing an internal 5.0.1 build. Not sure if this change has made it into the 5.0.200 preview builds from https://github.com/dotnet/installer yet.
@mrward Ah okay. Thank you. I will take a look if there are some changes there. It is a pretty blocking issue for me since i cannot debug in the normal way without console logging.
I am assuming there will be a more official debugger zip at some point with this updated libdbgshim.dylib that can be bundled with OmniSharp and VS Mac?
Yes, soon after 5.0.1 ships the VS debugger team expects to put out a new release of vsdbg-ui which can be included into the VS Code C# extension and VS For Mac.
@wingchunninja Sorry, I was testing an internal 5.0.1 build. Not sure if this change has made it into the 5.0.200 preview builds from https://github.com/dotnet/installer yet.
@mrward Thank you for the hint. This did the work for me 🙂
Most helpful comment
Re workaround:
It seems that downloading and installing the "Command Line Developer Tools for Xcode 11.5" (
*.dmg
, contains an installer package (*.pkg
), about 260MB) from https://developer.apple.com/download/more/ is sufficient (no need for Xcode 11 as a whole).Once installed, switch to this version of the tools with
sudo xcode-select -s /Library/Developer/CommandLineTools