I've upgraded to MacOS Ventura on Intel and am having trouble getting the debugger to work. I'm using Visual Studio 2022 for Mac, version 17.4.2 (latest stable).
To Reproduce:
- I create a default macOS Application (Mac -> App -> .Net). This is a Cocoa app using a storyboard, with .Net7.
- Click "Run Project". The app runs fine.
- Click "Start Debugging Project". In the application output tab, I see the licence message "You may only use...", and then nothing. The app doesn't start. There's no more messages.
Looking in console - I can see this message:
/Users/Paul/Dev/DotNetMacOSTestProject/TestDotNet7/bin/Debug/net7.0-macos/osx-x64/TestDotNet7.app/Contents/MonoBundle/libmscordbi.dylib" (cs_mtime:1671400321.653023908 == mtime:1671400321.653023908) (signed:1 validated:1 tainted:1 nx:0 wpmapped:0 dirty:0 depth:0)
Further down there is the following message:
Aggregated. Transform: StabilityCrashNumerator3 Dirty: 1 Event: com.apple.stability.crash {"coalitionName":"com.microsoft.visual-studio","exceptionCodes":"0x0000000000000032, 0x00000001094f0000(\n 50,\n 4451139584\n)EXC_BAD_ACCESSSIGKILL (Code Signature Invalid)UNKNOWN_0x32 at 0x00000001094f0000","incidentID":"85F597C2-48CC-4C55-ADEA-77D3E588FAE9","logwritten":0,"process":"vsdbg-ui","responsibleApp":"VisualStudio","terminationReasonExceptionCode":"0x2","terminationReasonNamespace":"CODESIGNING","timestamp":1671400809131127}
So... likely CodeSigning.
Switching the project to .Net6 I see the same result - the app runs ok but can't debug. I have reinstalled visual studio - same result. I can run vsdbg-ui from the command line, and it starts.
Any ideas as to what could be wrong? Or what sort of troubleshooting I can do. Thx. Paul
1条答案
按热度按时间w8f9ii691#
问题是,如果您在Mac上运行vsdbg和vsdbg-ui(用于跨平台调试.NET核心代码的底层可执行文件),则需要使用可信证书重新进行代码签名。
请看我在Github上打开的the issue。
github用户@basilfx发布了一个临时解决方案,可能会解决您的问题。
他的答案适用于VS代码,但您只需要找到在您的情况下使用的可执行文件,并应用相同的修复。
为了方便起见,我将在下面重申他的回答,但这里有他在Github问题上评论的链接
创建自签名代码签名证书:
如果您曾经更新过Visual Studio,请务必小心,因为它也可能会将vsdbg/vsdbg-ui可执行文件替换为新版本,您必须在这些新版本上重新应用修复程序,因为您的代码签名可执行文件已被替换。
长期的解决方案是在微软的法院在这一点上。
编辑:另一种选择是迫使你的Mac停止执行“允许从应用商店下载应用程序和确定的开发者”的限制。
这是一个隐藏的选项,在系统首选项-〉隐私区域,曾经在Sierra和更早的版本中可见。
然后关闭任何已经打开的系统首选项应用程序,然后打开系统首选项-〉隐私-〉一般选项卡,你应该看到现在有一个“任何地方”选项下的“允许应用程序下载:“区域。
这已经有效地关闭了应用程序需要由开发人员签名的需求,所以这样做的风险自担!