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

WIP: Build CoreCLR for Mac Catalyst OS #51000

Closed
wants to merge 35 commits into from

Conversation

directhex
Copy link
Member

This is at a proof-of-concept stage, for wider discussion.

Mac Catalyst is Apple's approach towards multi-platform development: essentially, it allows building iPhone/iPad/AppleTV apps (using the iOS/tvOS API) as desktop macOS apps. For example, on Big Sur, the News app bundled with the OS is a Mac Catalyst app.

.NET 6 features support for Mac Catalyst, using the Mono runtime (as Mono already supports iOS, the incremental work to make Mono work on Mac Catalyst is minimal).

However, because our recommendation to users is that they use CoreCLR for desktop and server workloads, I've been tasked with moving Mac Catalyst onto CoreCLR.

I've had to stub out a bunch of critical stuff in this PR, and there are manual steps needed to make it work which I haven't plumbed into the build system (largely around using codesign --entitlements to permit the corerun binary to do JITting), but I have Hello World running at the very least:

$ CORE_ROOT=/Users/directhex/Projects/runtime/artifacts/bin/coreclr/MacCatalyst.x64.Debug CORE_LIBRARIES=/Users/directhex/Projects/runtime/artifacts/bin/testhost/net6.0-MacCatalyst-Debug-x64/shared/Microsoft.NETCore.App/6.0.0 /Users/directhex/Projects/runtime/artifacts/bin/coreclr/MacCatalyst.x64.Debug/corerun /tmp/helloworld/bin/Debug/net5.0/helloworld.dll
2021-04-09 10:23:50.863 corerun[14120:13113288] Hello World!

Some stuff, on the other hand, I don't have working:

$ CORE_ROOT=/Users/directhex/Projects/runtime/artifacts/bin/coreclr/MacCatalyst.x64.Debug CORE_LIBRARIES=/Users/directhex/Projects/runtime/artifacts/bin/testhost/net6.0-MacCatalyst-Debug-x64/shared/Microsoft.NETCore.App/6.0.0 /Users/directhex/Projects/runtime/artifacts/bin/coreclr/MacCatalyst.x64.Debug/corerun badfilename.dll
Unhandled exception.
Assert failure(PID 14728 [0x00003988], Thread: 13116856 [0xc825b8]): !"Recursion in CLRException::GetThrowable"
    File: /Users/directhex/Projects/runtime/src/coreclr/vm/clrex.cpp Line: 143
    Image: /Users/directhex/Projects/runtime/artifacts/bin/coreclr/MacCatalyst.x64.Debug/corerun

[1]    14728 abort      CORE_ROOT= CORE_LIBRARIES=  badfilename.dll

I don't have much experience with CoreCLR internals, so I'd welcome any suggestions as to where to head next in getting this in slightly better shape

@directhex directhex added NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) discussion labels Apr 9, 2021
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@steveisok steveisok added the runtime-coreclr specific to the CoreCLR runtime label Apr 9, 2021
@steveisok
Copy link
Member

@janvorli Do you think you could help Jo figure out what may be wrong?

@janvorli
Copy link
Member

janvorli commented Apr 9, 2021

@directhex the "Recursion in CLRException::GetThrowable" error means that when attempting to create an exception object, another exception occurred. There can be many reasons for that - missing assembly with the type of the exception to be thrown is one of them. Would you be able to run it under lldb to see the call stack and possibly some more details?

@directhex
Copy link
Member Author

(lldb) run badfilename.dll
Process 12368 launched: '/Users/directhex/Projects/runtime/artifacts/bin/coreclr/MacCatalyst.x64.Debug/corerun' (x86_64)
Unhandled exception.
Assert failure(PID 12368 [0x00003050], Thread: 14633474 [0xdf4a02]): !"Recursion in CLRException::GetThrowable"
    File: /Users/directhex/Projects/runtime/src/coreclr/vm/clrex.cpp Line: 143
    Image: /Users/directhex/Projects/runtime/artifacts/bin/coreclr/MacCatalyst.x64.Debug/corerun

Process 12368 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
    frame #0: 0x00000001090ca063 libcoreclr.dylib`DBG_DebugBreak at debugbreak.S:9
   6
   7   	LEAF_ENTRY DBG_DebugBreak, _TEXT
   8   	        int3
-> 9   	        ret
   10  	LEAF_END_MARKED DBG_DebugBreak, _TEXT
   11
Target 0: (corerun) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
  * frame #0: 0x00000001090ca063 libcoreclr.dylib`DBG_DebugBreak at debugbreak.S:9
    frame #1: 0x000000010901c3e2 libcoreclr.dylib`::DebugBreak() at debug.cpp:406:9
    frame #2: 0x00000001097454db libcoreclr.dylib`::DbgAssertDialog(szFile="/Users/directhex/Projects/runtime/src/coreclr/vm/clrex.cpp", iLine=143, szExpr="!\"Recursion in CLRException::GetThrowable\"") at debug.cpp:697:13
    frame #3: 0x00000001093b838c libcoreclr.dylib`CLRException::GetThrowable(this=0x000000010bf04170) at clrex.cpp:143:17
    frame #4: 0x00000001093b94c1 libcoreclr.dylib`CLRException::GetThrowableFromException(pException=0x000000010bf04170) at clrex.cpp:634:45
    frame #5: 0x000000010920998b libcoreclr.dylib`UnwindAndContinueRethrowHelperInsideCatch(pEntryFrame=0x0000000304160f18, pException=0x000000010bf04170) at excep.cpp:8108:29
    frame #6: 0x00000001092fa697 libcoreclr.dylib`::PreStubWorker(pTransitionBlock=0x0000000304161008, pMD=0x000000011f9180f8) at prestub.cpp:2001:9
    frame #7: 0x00000001096f9713 libcoreclr.dylib`ThePreStub at theprestubamd64.S:16
    frame #8: 0x000000011f5a3ec2
    frame #9: 0x000000011f5a3860
    frame #10: 0x000000011f5a327b
    frame #11: 0x000000011f5a31c0
    frame #12: 0x000000011f5a2c8f
    frame #13: 0x000000011f5a296d
    frame #14: 0x000000011f59e858
    frame #15: 0x000000011f595dc2
    frame #16: 0x000000011f595889
    frame #17: 0x000000011f595607
    frame #18: 0x000000011f595442
    frame #19: 0x000000011f594713
    frame #20: 0x000000011f591f7c
    frame #21: 0x000000011f591ea8
    frame #22: 0x000000011f5a1756
    frame #23: 0x000000011f5a16d9
    frame #24: 0x00000001096f8959 libcoreclr.dylib`CallDescrWorkerInternal at calldescrworkeramd64.S:97
    frame #25: 0x00000001093b4f3f libcoreclr.dylib`CallDescrWorkerWithHandler(pCallDescrData=0x0000000304161c38, fCriticalCall=NO) at callhelpers.cpp:71:5
    frame #26: 0x00000001093b5154 libcoreclr.dylib`DispatchCallDebuggerWrapper(this=0x0000000304161be8, pParam=0x0000000304161bf8)::$_1::operator()(DispatchCallDebuggerWrapper(CallDescrData*, int)::Param*) const at callhelpers.cpp:159:9
    frame #27: 0x00000001093b4fe8 libcoreclr.dylib`DispatchCallDebuggerWrapper(pCallDescrData=0x0000000304161c38, fCriticalCall=NO) at callhelpers.cpp:163:5
    frame #28: 0x00000001093b52bb libcoreclr.dylib`DispatchCallSimple(pSrc=0x0000000304161db0, numStackSlotsToCopy=0, pTargetAddress=4820963992, dwDispatchCallSimpleFlags=2) at callhelpers.cpp:218:9
    frame #29: 0x00000001093b6087 libcoreclr.dylib`CallDefaultConstructor(ref=OBJECTREF @ 0x0000000304161e98) at callhelpers.cpp:603:5
    frame #30: 0x00000001093bb55c libcoreclr.dylib`EEException::CreateThrowable(this=0x0000000108438e90) at clrex.cpp:1050:9
    frame #31: 0x00000001093b852f libcoreclr.dylib`CLRException::GetThrowable(this=0x0000000108438e90) at clrex.cpp:178:25
    frame #32: 0x00000001093b94c1 libcoreclr.dylib`CLRException::GetThrowableFromException(pException=0x0000000108438e90) at clrex.cpp:634:45
    frame #33: 0x000000010920998b libcoreclr.dylib`UnwindAndContinueRethrowHelperInsideCatch(pEntryFrame=0x00000003041629f8, pException=0x0000000108438e90) at excep.cpp:8108:29
    frame #34: 0x00000001092fa697 libcoreclr.dylib`::PreStubWorker(pTransitionBlock=0x0000000304162ae8, pMD=0x000000011f917e88) at prestub.cpp:2001:9
    frame #35: 0x00000001096f9713 libcoreclr.dylib`ThePreStub at theprestubamd64.S:16
    frame #36: 0x000000011f5a1163
    frame #37: 0x000000011f5a0c76
    frame #38: 0x000000011f5a00b5
    frame #39: 0x00000001096f8959 libcoreclr.dylib`CallDescrWorkerInternal at calldescrworkeramd64.S:97
    frame #40: 0x00000001093b4f3f libcoreclr.dylib`CallDescrWorkerWithHandler(pCallDescrData=0x0000000304162d48, fCriticalCall=NO) at callhelpers.cpp:71:5
    frame #41: 0x00000001093b5154 libcoreclr.dylib`DispatchCallDebuggerWrapper(this=0x0000000304162cf8, pParam=0x0000000304162d08)::$_1::operator()(DispatchCallDebuggerWrapper(CallDescrData*, int)::Param*) const at callhelpers.cpp:159:9
    frame #42: 0x00000001093b4fe8 libcoreclr.dylib`DispatchCallDebuggerWrapper(pCallDescrData=0x0000000304162d48, fCriticalCall=NO) at callhelpers.cpp:163:5
    frame #43: 0x00000001093b52bb libcoreclr.dylib`DispatchCallSimple(pSrc=0x0000000304162f90, numStackSlotsToCopy=0, pTargetAddress=4820952704, dwDispatchCallSimpleFlags=2) at callhelpers.cpp:218:9
    frame #44: 0x00000001092b80cc libcoreclr.dylib`MethodTable::RunClassInitEx(this=0x000000011f913fd0, pThrowable=0x00000003041633a0) at methodtable.cpp:3151:13
    frame #45: 0x00000001092b9294 libcoreclr.dylib`MethodTable::DoRunClassInitThrowing(this=0x000000011f913fd0) at methodtable.cpp:3339:30
    frame #46: 0x00000001092ba14d libcoreclr.dylib`MethodTable::CheckRunClassInitThrowing(this=0x000000011f913fd0) at methodtable.cpp:3479:9
    frame #47: 0x000000010946ecb1 libcoreclr.dylib`::JIT_GetSharedNonGCStaticBase_Helper(pLocalModule=0x000000011f560028, dwClassDomainID=490) at jithelpers.cpp:1415:10
    frame #48: 0x000000011f5a003c
    frame #49: 0x000000011f59fd84
    frame #50: 0x000000011f59f126
    frame #51: 0x000000011f59f05d
    frame #52: 0x00000001096f8959 libcoreclr.dylib`CallDescrWorkerInternal at calldescrworkeramd64.S:97
    frame #53: 0x00000001093b4f3f libcoreclr.dylib`CallDescrWorkerWithHandler(pCallDescrData=0x0000000304164378, fCriticalCall=NO) at callhelpers.cpp:71:5
    frame #54: 0x00000001093b5154 libcoreclr.dylib`DispatchCallDebuggerWrapper(this=0x0000000304164328, pParam=0x0000000304164338)::$_1::operator()(DispatchCallDebuggerWrapper(CallDescrData*, int)::Param*) const at callhelpers.cpp:159:9
    frame #55: 0x00000001093b4fe8 libcoreclr.dylib`DispatchCallDebuggerWrapper(pCallDescrData=0x0000000304164378, fCriticalCall=NO) at callhelpers.cpp:163:5
    frame #56: 0x00000001093b52bb libcoreclr.dylib`DispatchCallSimple(pSrc=0x00000003041645c0, numStackSlotsToCopy=0, pTargetAddress=4820792992, dwDispatchCallSimpleFlags=2) at callhelpers.cpp:218:9
    frame #57: 0x00000001092b80cc libcoreclr.dylib`MethodTable::RunClassInitEx(this=0x000000011f6a7ee0, pThrowable=0x00000003041649d0) at methodtable.cpp:3151:13
    frame #58: 0x00000001092b9294 libcoreclr.dylib`MethodTable::DoRunClassInitThrowing(this=0x000000011f6a7ee0) at methodtable.cpp:3339:30
    frame #59: 0x00000001092ba14d libcoreclr.dylib`MethodTable::CheckRunClassInitThrowing(this=0x000000011f6a7ee0) at methodtable.cpp:3479:9
    frame #60: 0x000000010946ecb1 libcoreclr.dylib`::JIT_GetSharedNonGCStaticBase_Helper(pLocalModule=0x000000011f560028, dwClassDomainID=473) at jithelpers.cpp:1415:10
    frame #61: 0x000000011f59ef56
    frame #62: 0x000000011f59e7d2
    frame #63: 0x000000011f595dc2
    frame #64: 0x000000011f595889
    frame #65: 0x000000011f595607
    frame #66: 0x000000011f595442
    frame #67: 0x000000011f594713
    frame #68: 0x000000011f591f7c
    frame #69: 0x000000011f591ea8
    frame #70: 0x000000011f591e46
    frame #71: 0x000000011f58fe05
    frame #72: 0x00000001096f8959 libcoreclr.dylib`CallDescrWorkerInternal at calldescrworkeramd64.S:97
    frame #73: 0x00000001093b4f3f libcoreclr.dylib`CallDescrWorkerWithHandler(pCallDescrData=0x0000000304165fd8, fCriticalCall=NO) at callhelpers.cpp:71:5
    frame #74: 0x00000001093b5c48 libcoreclr.dylib`MethodDescCallSite::CallTargetWorker(this=0x00000003041661d8, pArguments=0x0000000304166300, pReturnValue=0x0000000304166160, cbReturnValue=8) at callhelpers.cpp:547:9
    frame #75: 0x000000010911037b libcoreclr.dylib`MethodDescCallSite::Call_RetSTRINGREF(this=0x00000003041661d8, pArguments=0x0000000304166300) at callhelpers.h:462:9
    frame #76: 0x00000001091fb0f6 libcoreclr.dylib`GetExceptionMessage(throwable=OBJECTREF @ 0x0000000304166338) at excep.cpp:278:24
    frame #77: 0x00000001091faf6d libcoreclr.dylib`GetExceptionMessage(throwable=OBJECTREF @ 0x0000000304166398, result=0x00000003041663b0) at excep.cpp:246:25
    frame #78: 0x0000000109207739 libcoreclr.dylib`GetExceptionMessageWrapper(pThread=0x0000000108829c10, throwable=OBJECTREF @ 0x0000000304166640) at excep.cpp:5139:5
    frame #79: 0x000000010920759e libcoreclr.dylib`DefaultCatchHandlerExceptionMessageWorker(pThread=0x0000000108829c10, throwable=OBJECTREF @ 0x0000000304166810, buf=u"Unhandled exception.", buf_size=128, sendWindowsEventLog=YES) at excep.cpp:5163:27
    frame #80: 0x0000000109207fc9 libcoreclr.dylib`DefaultCatchHandler(pExceptionPointers=0x0000000108510ee0, pThrowableIn=0x0000000000000000, useLastThrownObject=YES, isTerminating=YES, isThreadBaseFilter=NO, sendAppDomainEvents=NO, sendWindowsEventLog=YES) at excep.cpp:5372:21
    frame #81: 0x0000000109207043 libcoreclr.dylib`InternalUnhandledExceptionFilter_Worker(this=0x0000000304166bd8, pParam=0x0000000304166be8)::$_3::operator()(InternalUnhandledExceptionFilter_Worker(_EXCEPTION_POINTERS*)::Param*) const at excep.cpp:4871:9
    frame #82: 0x00000001092067f4 libcoreclr.dylib`InternalUnhandledExceptionFilter_Worker(pExceptionInfo=0x0000000108510ee0) at excep.cpp:4876:5
    frame #83: 0x00000001091b2bd0 libcoreclr.dylib`CorHost2::ExecuteAssembly(this=0x0000000108410750, dwAppDomainId=1, pwzAssemblyPath=u"badfilename.dll", argc=0, argv=0x0000000000000000, pReturnValue=0x00000003041671b8) at corhost.cpp:395:5
    frame #84: 0x00000001090d612d libcoreclr.dylib`::coreclr_execute_assembly(hostHandle=0x0000000108410750, domainId=1, argc=0, argv=0x0000000108405ca0, managedAssemblyPath="badfilename.dll", exitCode=0x00000003041671b8) at unixinterface.cpp:446:24
    frame #85: 0x0000000100005326 corerun`run(config=0x00000003041675b8) at corerun.cpp:358:18
    frame #86: 0x000000010000390b corerun`main(argc=2, argv=0x0000000304167638) at corerun.cpp:509:21
    frame #87: 0x00007fff20355621 libdyld.dylib`start + 1
    frame #88: 0x00007fff20355621 libdyld.dylib`start + 1

@directhex
Copy link
Member Author

@janvorli any clues in the above from lldb?

@janvorli
Copy link
Member

@directhex I am sorry, I've missed your comment with the stack trace before. So the CorHost2::ExecuteAssembly called Assembly::ExecuteMainMethod, which has resulted in a thrown managed exception somewhere. The runtime then tried to log the unhandled exception to console, but attempt to call ToString on the Exception resulted in a failure and an attempt to throw another exception somewhere during an attempt to JIT or get R2R code for a managed method.

To debug the issue, I'd recommend using SOS plugin so that you can dump stack trace including managed methods and also some managed objects if needed. Here is a guide on how to install SOS: https://github.com/dotnet/diagnostics/blob/main/documentation/installing-sos-instructions.md
After installing SOS and running your process under lldb, the new SOS clrstack -f lldb command will show you the stack trace with both native and managed method names.

@directhex directhex force-pushed the maccatalyst-coreclr branch 2 times, most recently from 4857326 to 0fe63e3 Compare April 16, 2021 18:51
@directhex
Copy link
Member Author

(lldb) clrstack -f
OS Thread Id: 0x83e0b (1)
        Child SP               IP Call Site
00007FFEEFBF8548 00000001010CA083 libcoreclr.dylib!DBG_DebugBreak + 1 at /Users/directhex/Projects/runtime/src/coreclr/pal/src/arch/amd64/debugbreak.S:9
00007FFEEFBF8550 000000010101C402 libcoreclr.dylib!DebugBreak + 306 at /Users/directhex/Projects/runtime/src/coreclr/pal/src/debug/debug.cpp:0
00007FFEEFBF8590 00000001017454FB libcoreclr.dylib!DbgAssertDialog + 267 at /Users/directhex/Projects/runtime/src/coreclr/utilcode/debug.cpp:700
00007FFEEFBF85E0 00000001013B83AC libcoreclr.dylib!CLRException::GetThrowable() + 780 at /Users/directhex/Projects/runtime/src/coreclr/vm/clrex.cpp:146
00007FFEEFBF88D0 00000001013B94E1 libcoreclr.dylib!CLRException::GetThrowableFromException(Exception*) + 225 at /Users/directhex/Projects/runtime/src/coreclr/vm/clrex.cpp:634
00007FFEEFBF8E30 00000001012099AB libcoreclr.dylib!UnwindAndContinueRethrowHelperInsideCatch(Frame*, Exception*) + 187 at /Users/directhex/Projects/runtime/src/coreclr/vm/excep.cpp:8108
00007FFEEFBF8ED0 00000001012FA6B7 libcoreclr.dylib!PreStubWorker + 1911 at /Users/directhex/Projects/runtime/src/coreclr/vm/prestub.cpp:2001
00007FFEEFBF90C8                  [PrestubMethodFrame: 00007ffeefbf90c8] System.Private.CoreLib.dll!Interop+Globalization.GetLocaleName(System.String, Char*, Int32)
00007FFEEFBF9130 00000001016F9733 libcoreclr.dylib!ThePreStub + 92 at /Users/directhex/Projects/runtime/src/coreclr/vm/amd64/theprestubamd64.S:18
00007FFEEFBF9220 00000001075C41C2 System.Private.CoreLib.dll!System.Globalization.CultureData.GetLocaleName(System.String, System.String ByRef) + 146
00007FFEEFBF93B0 00000001075C3B58 System.Private.CoreLib.dll!System.Globalization.CultureData.InitIcuCultureDataCore() + 440
00007FFEEFBF94F0 00000001075C356B System.Private.CoreLib.dll!System.Globalization.CultureData.InitCultureDataCore() + 43
00007FFEEFBF9510 00000001075C34B1 System.Private.CoreLib.dll!System.Globalization.CultureData.CreateCultureData(System.String, Boolean) + 593
00007FFEEFBF95D0 00000001075C2F70 System.Private.CoreLib.dll!System.Globalization.CultureData.GetCultureData(System.String, Boolean) + 672
00007FFEEFBF96C0 00000001075C2C4E System.Private.CoreLib.dll!System.Globalization.CultureInfo.CreateCultureInfoNoThrow(System.String, Boolean) + 94
00007FFEEFBF9710 00000001075BEAE9 System.Private.CoreLib.dll!System.Globalization.CultureInfo.GetCultureInfo(System.String) + 361
00007FFEEFBF97E0 00000001075B5F63 System.Private.CoreLib.dll!System.Resources.ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(System.Reflection.Assembly, System.Resources.UltimateResourceFallbackLocation ByRef) + 483
00007FFEEFBF9950 00000001075B5A2A System.Private.CoreLib.dll!System.Resources.ResourceManager.CommonAssemblyInit() + 314
00007FFEEFBF99B0 00000001075B57A8 System.Private.CoreLib.dll!System.Resources.ResourceManager..ctor(System.Type) + 392
00007FFEEFBF9A30 00000001075B55E3 System.Private.CoreLib.dll!System.SR.get_ResourceManager() + 147
00007FFEEFBF9A70 00000001075B4894 System.Private.CoreLib.dll!System.SR.InternalGetResourceString(System.String) + 964
00007FFEEFBF9B90 00000001075B20DD System.Private.CoreLib.dll!System.SR.GetResourceString(System.String, System.String) + 157
00007FFEEFBF9C00 00000001075B2008 System.Private.CoreLib.dll!System.SR.GetResourceString(System.String) + 56
00007FFEEFBF9C30 00000001075C1A26 System.Private.CoreLib.dll!System.SR.get_Arg_DllNotFoundException() + 54
00007FFEEFBF9C50 00000001075C19A9 System.Private.CoreLib.dll!System.DllNotFoundException..ctor() + 57
00007FFEEFBF9C80 00000001016F8979 libcoreclr.dylib!CallDescrWorkerInternal + 124 at /Users/directhex/Projects/runtime/src/coreclr/vm/amd64/calldescrworkeramd64.S:101
00007FFEEFBF9CA0 00000001013B4F5F libcoreclr.dylib!CallDescrWorkerWithHandler(CallDescrData*, int) + 319 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:71
00007FFEEFBF9D10 00000001013B5174 libcoreclr.dylib!DispatchCallDebuggerWrapper(CallDescrData*, int)::$_1::operator()(DispatchCallDebuggerWrapper(CallDescrData*, int)::Param*) const + 36 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:163
00007FFEEFBF9D30 00000001013B5008 libcoreclr.dylib!DispatchCallDebuggerWrapper(CallDescrData*, int) + 120 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:163
00007FFEEFBF9DE0 00000001013B52DB libcoreclr.dylib!DispatchCallSimple(unsigned long*, unsigned int, unsigned long, unsigned int) + 171 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:221
00007FFEEFBF9E60 00000001013B60A7 libcoreclr.dylib!CallDefaultConstructor(OBJECTREF) + 599 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:603
00007FFEEFBF9FB0 00000001013BB57C libcoreclr.dylib!EEException::CreateThrowable() + 316 at /Users/directhex/Projects/runtime/src/coreclr/vm/clrex.cpp:1050
00007FFEEFBFA0C0 00000001013B854F libcoreclr.dylib!CLRException::GetThrowable() + 1199 at /Users/directhex/Projects/runtime/src/coreclr/vm/clrex.cpp:178
00007FFEEFBFA3B0 00000001013B94E1 libcoreclr.dylib!CLRException::GetThrowableFromException(Exception*) + 225 at /Users/directhex/Projects/runtime/src/coreclr/vm/clrex.cpp:634
00007FFEEFBFA910 00000001012099AB libcoreclr.dylib!UnwindAndContinueRethrowHelperInsideCatch(Frame*, Exception*) + 187 at /Users/directhex/Projects/runtime/src/coreclr/vm/excep.cpp:8108
00007FFEEFBFA9B0 00000001012FA6B7 libcoreclr.dylib!PreStubWorker + 1911 at /Users/directhex/Projects/runtime/src/coreclr/vm/prestub.cpp:2001
00007FFEEFBFABA8                  [PrestubMethodFrame: 00007ffeefbfaba8] System.Private.CoreLib.dll!Interop+Globalization.LoadICU()
00007FFEEFBFAC10 00000001016F9733 libcoreclr.dylib!ThePreStub + 92 at /Users/directhex/Projects/runtime/src/coreclr/vm/amd64/theprestubamd64.S:18
00007FFEEFBFAD00 00000001075C1433 System.Private.CoreLib.dll!System.Globalization.GlobalizationMode.LoadICU() + 35
00007FFEEFBFAD20 00000001075C0F46 System.Private.CoreLib.dll!System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode() + 134
00007FFEEFBFAD70 00000001075C0365 System.Private.CoreLib.dll!System.Globalization.GlobalizationMode..cctor() + 85
00007FFEEFBFAD90 00000001016F8979 libcoreclr.dylib!CallDescrWorkerInternal + 124 at /Users/directhex/Projects/runtime/src/coreclr/vm/amd64/calldescrworkeramd64.S:101
00007FFEEFBFADB0 00000001013B4F5F libcoreclr.dylib!CallDescrWorkerWithHandler(CallDescrData*, int) + 319 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:71
00007FFEEFBFAE20 00000001013B5174 libcoreclr.dylib!DispatchCallDebuggerWrapper(CallDescrData*, int)::$_1::operator()(DispatchCallDebuggerWrapper(CallDescrData*, int)::Param*) const + 36 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:163
00007FFEEFBFAE40 00000001013B5008 libcoreclr.dylib!DispatchCallDebuggerWrapper(CallDescrData*, int) + 120 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:163
00007FFEEFBFAEF0 00000001013B52DB libcoreclr.dylib!DispatchCallSimple(unsigned long*, unsigned int, unsigned long, unsigned int) + 171 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:221
00007FFEEFBFAF70 00000001012B80EC libcoreclr.dylib!MethodTable::RunClassInitEx(OBJECTREF*) + 1004 at /Users/directhex/Projects/runtime/src/coreclr/vm/methodtable.cpp:3151
00007FFEEFBFB1C0 00000001012B92B4 libcoreclr.dylib!MethodTable::DoRunClassInitThrowing() + 3252 at /Users/directhex/Projects/runtime/src/coreclr/vm/methodtable.cpp:3339
00007FFEEFBFBFC0 00000001012BA16D libcoreclr.dylib!MethodTable::CheckRunClassInitThrowing() + 381 at /Users/directhex/Projects/runtime/src/coreclr/vm/methodtable.cpp:3480
00007FFEEFBFC040 000000010146ECD1 libcoreclr.dylib!JIT_GetSharedNonGCStaticBase_Helper + 801 at /Users/directhex/Projects/runtime/src/coreclr/vm/jithelpers.cpp:1415
00007FFEEFBFC178                  [HelperMethodFrame: 00007ffeefbfc178]
00007FFEEFBFC2A0 00000001075C02EC System.Private.CoreLib.dll!System.Globalization.GlobalizationMode.get_Invariant() + 44
00007FFEEFBFC2B0 00000001075C0035 System.Private.CoreLib.dll!System.Globalization.CultureData.CreateCultureWithInvariantData() + 1925
00007FFEEFBFC370 00000001075BF3D7 System.Private.CoreLib.dll!System.Globalization.CultureData.get_Invariant() + 103
00007FFEEFBFC3A0 00000001075BF30D System.Private.CoreLib.dll!System.Globalization.CultureInfo..cctor() + 45
00007FFEEFBFC3C0 00000001016F8979 libcoreclr.dylib!CallDescrWorkerInternal + 124 at /Users/directhex/Projects/runtime/src/coreclr/vm/amd64/calldescrworkeramd64.S:101
00007FFEEFBFC3E0 00000001013B4F5F libcoreclr.dylib!CallDescrWorkerWithHandler(CallDescrData*, int) + 319 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:71
00007FFEEFBFC450 00000001013B5174 libcoreclr.dylib!DispatchCallDebuggerWrapper(CallDescrData*, int)::$_1::operator()(DispatchCallDebuggerWrapper(CallDescrData*, int)::Param*) const + 36 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:163
00007FFEEFBFC470 00000001013B5008 libcoreclr.dylib!DispatchCallDebuggerWrapper(CallDescrData*, int) + 120 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:163
00007FFEEFBFC520 00000001013B52DB libcoreclr.dylib!DispatchCallSimple(unsigned long*, unsigned int, unsigned long, unsigned int) + 171 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:221
00007FFEEFBFC5A0 00000001012B80EC libcoreclr.dylib!MethodTable::RunClassInitEx(OBJECTREF*) + 1004 at /Users/directhex/Projects/runtime/src/coreclr/vm/methodtable.cpp:3151
00007FFEEFBFC7F0 00000001012B92B4 libcoreclr.dylib!MethodTable::DoRunClassInitThrowing() + 3252 at /Users/directhex/Projects/runtime/src/coreclr/vm/methodtable.cpp:3339
00007FFEEFBFD5F0 00000001012BA16D libcoreclr.dylib!MethodTable::CheckRunClassInitThrowing() + 381 at /Users/directhex/Projects/runtime/src/coreclr/vm/methodtable.cpp:3480
00007FFEEFBFD670 000000010146ECD1 libcoreclr.dylib!JIT_GetSharedNonGCStaticBase_Helper + 801 at /Users/directhex/Projects/runtime/src/coreclr/vm/jithelpers.cpp:1415
00007FFEEFBFD7A8                  [HelperMethodFrame: 00007ffeefbfd7a8]
00007FFEEFBFD8D0 00000001075BF1F7 System.Private.CoreLib.dll!System.Globalization.CultureInfo.get_CachedCulturesByName() + 71
00007FFEEFBFD920 00000001075BEA63 System.Private.CoreLib.dll!System.Globalization.CultureInfo.GetCultureInfo(System.String) + 227
00007FFEEFBFD9F0 00000001075B5F63 System.Private.CoreLib.dll!System.Resources.ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(System.Reflection.Assembly, System.Resources.UltimateResourceFallbackLocation ByRef) + 483
00007FFEEFBFDB60 00000001075B5A2A System.Private.CoreLib.dll!System.Resources.ResourceManager.CommonAssemblyInit() + 314
00007FFEEFBFDBC0 00000001075B57A8 System.Private.CoreLib.dll!System.Resources.ResourceManager..ctor(System.Type) + 392
00007FFEEFBFDC40 00000001075B55E3 System.Private.CoreLib.dll!System.SR.get_ResourceManager() + 147
00007FFEEFBFDC80 00000001075B4894 System.Private.CoreLib.dll!System.SR.InternalGetResourceString(System.String) + 964
00007FFEEFBFDDA0 00000001075B20DD System.Private.CoreLib.dll!System.SR.GetResourceString(System.String, System.String) + 157
00007FFEEFBFDE10 00000001075B2008 System.Private.CoreLib.dll!System.SR.GetResourceString(System.String) + 56
00007FFEEFBFDE40 00000001075B1FA6 System.Private.CoreLib.dll!System.SR.get_IO_FileName_Name() + 54
00007FFEEFBFDE60 00000001075AFF46 System.Private.CoreLib.dll!System.IO.FileNotFoundException.ToString() + 278
00007FFEEFBFDF80 00000001016F8979 libcoreclr.dylib!CallDescrWorkerInternal + 124 at /Users/directhex/Projects/runtime/src/coreclr/vm/amd64/calldescrworkeramd64.S:101
00007FFEEFBFDFA0 00000001013B4F5F libcoreclr.dylib!CallDescrWorkerWithHandler(CallDescrData*, int) + 319 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:71
00007FFEEFBFE010 00000001013B5C68 libcoreclr.dylib!MethodDescCallSite::CallTargetWorker(unsigned long const*, unsigned long*, int) + 2376 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:550
00007FFEEFBFE300 000000010111039B libcoreclr.dylib!MethodDescCallSite::Call_RetSTRINGREF(unsigned long const*) + 59 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.h:462
00007FFEEFBFE340 00000001011FB116 libcoreclr.dylib!GetExceptionMessage(OBJECTREF) + 310 at /Users/directhex/Projects/runtime/src/coreclr/vm/excep.cpp:278
00007FFEEFBFE4D0 00000001011FAF8D libcoreclr.dylib!GetExceptionMessage(OBJECTREF, SString&) + 45 at /Users/directhex/Projects/runtime/src/coreclr/vm/excep.cpp:246
00007FFEEFBFE510 0000000101207759 libcoreclr.dylib!GetExceptionMessageWrapper(Thread*, OBJECTREF) + 121 at /Users/directhex/Projects/runtime/src/coreclr/vm/excep.cpp:5139
00007FFEEFBFE7B0 00000001012075BE libcoreclr.dylib!DefaultCatchHandlerExceptionMessageWorker(Thread*, OBJECTREF, char16_t*, int, int) + 318 at /Users/directhex/Projects/runtime/src/coreclr/vm/excep.cpp:5163
00007FFEEFBFE8A0 0000000101207FE9 libcoreclr.dylib!DefaultCatchHandler(_EXCEPTION_POINTERS*, OBJECTREF*, int, int, int, int, int) + 2009 at /Users/directhex/Projects/runtime/src/coreclr/vm/excep.cpp:5372
00007FFEEFBFEC40 0000000101207063 libcoreclr.dylib!InternalUnhandledExceptionFilter_Worker(_EXCEPTION_POINTERS*)::$_3::operator()(InternalUnhandledExceptionFilter_Worker(_EXCEPTION_POINTERS*)::Param*) const + 1363 at /Users/directhex/Projects/runtime/src/coreclr/vm/excep.cpp:4876
00007FFEEFBFECD0 0000000101206814 libcoreclr.dylib!InternalUnhandledExceptionFilter_Worker(_EXCEPTION_POINTERS*) + 1316 at /Users/directhex/Projects/runtime/src/coreclr/vm/excep.cpp:4876
00007FFEEFBFEEB0 00000001011B2BF0 libcoreclr.dylib!CorHost2::ExecuteAssembly(unsigned int, char16_t const*, int, char16_t const**, unsigned int*) + 2704 at /Users/directhex/Projects/runtime/src/coreclr/vm/corhost.cpp:395
00007FFEEFBFF1B0 00000001010D614D libcoreclr.dylib!coreclr_execute_assembly + 349 at /Users/directhex/Projects/runtime/src/coreclr/dlls/mscoree/unixinterface.cpp:446
00007FFEEFBFF2A0 0000000100005326 corerun!run(configuration const&) + 2678 at /Users/directhex/Projects/runtime/src/coreclr/hosts/corerun/corerun.cpp:358
00007FFEEFBFF730 000000010000390B corerun!main + 203 at /Users/directhex/Projects/runtime/src/coreclr/hosts/corerun/corerun.cpp:509
00007FFEEFBFF7D0 00007FFF72604CC9 libdyld.dylib!start + 1```

@directhex
Copy link
Member Author

If I'm reading that correctly, it looks like I might have stubbed things out too hard in the vicinity of ICU.

@janvorli
Copy link
Member

It looks like that. You may be able to workaround it by using invariant globalization mode (https://github.com/dotnet/runtime/blob/01b7e73cd378145264a7cb7a09365b41ed42b240/docs/design/features/globalization-invariant-mode.md), which doesn't use ICU.

@directhex
Copy link
Member Author

Success, now it "successfully" fails!

OK, now to see if invariant mode helps with Xunit

@directhex
Copy link
Member Author

directhex commented Apr 16, 2021

DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true CORE_ROOT=/Users/directhex/Projects/runtime/artifacts/bin/coreclr/MacCatalyst.x64.Debug CORE_LIBRARIES=/Users/directhex/Projects/runtime/artifacts/bin/testhost/net6.0-MacCatalyst-Debug-x64/shared/Microsoft.NETCore.App/6.0.0/ artifacts/bin/coreclr/MacCatalyst.x64.Debug/corerun artifacts/bin/System.Buffers.Tests/net6.0-Debug/xunit.console.dll artifacts/bin/System.Buffers.Tests/net6.0-Debug/System.Buffers.Tests.dll
2021-04-16 16:02:28.129 corerun[42438:970919]
2021-04-16 16:02:28.133 corerun[42438:970919] error: Operation is not supported on this platform.
2021-04-16 16:02:28.134 corerun[42438:970919]

Uh... okay then, corerun :|

@directhex
Copy link
Member Author

I haven't even changed anything, but today, it works less than it did last week.

(lldb) run
Process 99209 launched: '/Users/directhex/Projects/runtime/artifacts/bin/coreclr/MacCatalyst.x64.Debug/corerun' (x86_64)

Assert failure(PID 99209 [0x00018389], Thread: 1205407 [0x12649f]): id != 0
    File: /Users/directhex/Projects/runtime/src/coreclr/vm/ecall.cpp Line: 663
    Image: /Users/directhex/Projects/runtime/artifacts/bin/coreclr/MacCatalyst.x64.Debug/corerun

Process 99209 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
    frame #0: 0x00000001018cb073 libcoreclr.dylib`DBG_DebugBreak at debugbreak.S:9
   6
   7   	LEAF_ENTRY DBG_DebugBreak, _TEXT
   8   	        int3
-> 9   	        ret
   10  	LEAF_END_MARKED DBG_DebugBreak, _TEXT
   11
Target 0: (corerun) stopped.
(lldb) clrstack -f
OS Thread Id: 0x12649f (1)
        Child SP               IP Call Site
00007FFEEFBFC308 00000001018CB073 libcoreclr.dylib!DBG_DebugBreak + 1 at /Users/directhex/Projects/runtime/src/coreclr/pal/src/arch/amd64/debugbreak.S:9
00007FFEEFBFC310 000000010181D3F2 libcoreclr.dylib!DebugBreak + 306 at /Users/directhex/Projects/runtime/src/coreclr/pal/src/debug/debug.cpp:0
00007FFEEFBFC350 0000000101F484FB libcoreclr.dylib!DbgAssertDialog + 267 at /Users/directhex/Projects/runtime/src/coreclr/utilcode/debug.cpp:700
00007FFEEFBFC3A0 00000001019EC556 libcoreclr.dylib!ECall::GetQCallImpl(MethodDesc*) + 86 at /Users/directhex/Projects/runtime/src/coreclr/vm/ecall.cpp:663
00007FFEEFBFC460 00000001019D2460 libcoreclr.dylib!NDirect::NDirectLink(NDirectMethodDesc*) + 144 at /Users/directhex/Projects/runtime/src/coreclr/vm/dllimport.cpp:6373
00007FFEEFBFC7F0 00000001019D23A3 libcoreclr.dylib!NDirect::GetStubForILStub(NDirectMethodDesc*, MethodDesc**, unsigned int) + 563 at /Users/directhex/Projects/runtime/src/coreclr/vm/dllimport.cpp:5204
00007FFEEFBFC8A0 00000001019D2A41 libcoreclr.dylib!GetStubForInteropMethod(MethodDesc*, unsigned int, MethodDesc**) + 289 at /Users/directhex/Projects/runtime/src/coreclr/vm/dllimport.cpp:5328
00007FFEEFBFC9A0 0000000101AFDB44 libcoreclr.dylib!MethodDesc::DoPrestub(MethodTable*, CallerGCMode) + 1828 at /Users/directhex/Projects/runtime/src/coreclr/vm/prestub.cpp:2231
00007FFEEFBFCAF0 0000000101AFCBA9 libcoreclr.dylib!PreStubWorker + 1433 at /Users/directhex/Projects/runtime/src/coreclr/vm/prestub.cpp:1998
00007FFEEFBFCCF0                  [PrestubMethodFrame: 00007ffeefbfccf0] System.Private.CoreLib.dll!System.Diagnostics.Tracing.XplatEventLogger.IsEventSourceLoggingEnabled()
00007FFEEFBFCD60 0000000101EFC983 libcoreclr.dylib!ThePreStub + 92 at /Users/directhex/Projects/runtime/src/coreclr/vm/amd64/theprestubamd64.S:18
00007FFEEFBFCE50 0000000107D8ED33 System.Private.CoreLib.dll!System.Diagnostics.Tracing.XplatEventLogger.InitializePersistentListener() + 99
00007FFEEFBFCEA0 0000000107D8EC27 System.Private.CoreLib.dll!System.Diagnostics.Tracing.EventSource..cctor() + 87
00007FFEEFBFCEC0 0000000101EFBBC9 libcoreclr.dylib!CallDescrWorkerInternal + 124 at /Users/directhex/Projects/runtime/src/coreclr/vm/amd64/calldescrworkeramd64.S:101
00007FFEEFBFCEE0 0000000101BB70DF libcoreclr.dylib!CallDescrWorkerWithHandler(CallDescrData*, int) + 319 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:71
00007FFEEFBFCF50 0000000101BB72F4 libcoreclr.dylib!DispatchCallDebuggerWrapper(CallDescrData*, int)::$_1::operator()(DispatchCallDebuggerWrapper(CallDescrData*, int)::Param*) const + 36 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:164
00007FFEEFBFCF70 0000000101BB7188 libcoreclr.dylib!DispatchCallDebuggerWrapper(CallDescrData*, int) + 120 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:164
00007FFEEFBFD020 0000000101BB745B libcoreclr.dylib!DispatchCallSimple(unsigned long*, unsigned int, unsigned long, unsigned int) + 171 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:222
00007FFEEFBFD0A0 0000000101ABA7CC libcoreclr.dylib!MethodTable::RunClassInitEx(OBJECTREF*) + 1004 at /Users/directhex/Projects/runtime/src/coreclr/vm/methodtable.cpp:3151
00007FFEEFBFD2F0 0000000101ABB9CE libcoreclr.dylib!MethodTable::DoRunClassInitThrowing() + 3310 at /Users/directhex/Projects/runtime/src/coreclr/vm/methodtable.cpp:3341
00007FFEEFBFE0F0 0000000101ABC88D libcoreclr.dylib!MethodTable::CheckRunClassInitThrowing() + 381 at /Users/directhex/Projects/runtime/src/coreclr/vm/methodtable.cpp:3482
00007FFEEFBFE170 0000000101C716B1 libcoreclr.dylib!JIT_GetSharedNonGCStaticBase_Helper + 801 at /Users/directhex/Projects/runtime/src/coreclr/vm/jithelpers.cpp:1415
00007FFEEFBFE2A8                  [HelperMethodFrame: 00007ffeefbfe2a8]
00007FFEEFBFE3D0 0000000107D8E79C System.Private.CoreLib.dll!System.Diagnostics.Tracing.EventSource.get_IsSupported() + 44
00007FFEEFBFE3E0 0000000107D8CDFB System.Private.CoreLib.dll!System.StartupHookProvider.ProcessStartupHooks() + 171
00007FFEEFBFE580 0000000101EFBBC9 libcoreclr.dylib!CallDescrWorkerInternal + 124 at /Users/directhex/Projects/runtime/src/coreclr/vm/amd64/calldescrworkeramd64.S:101
00007FFEEFBFE5A0 0000000101BB70DF libcoreclr.dylib!CallDescrWorkerWithHandler(CallDescrData*, int) + 319 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:71
00007FFEEFBFE610 0000000101BB7DE8 libcoreclr.dylib!MethodDescCallSite::CallTargetWorker(unsigned long const*, unsigned long*, int) + 2376 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.cpp:551
00007FFEEFBFE900 00000001018EB143 libcoreclr.dylib!MethodDescCallSite::Call(unsigned long const*) + 35 at /Users/directhex/Projects/runtime/src/coreclr/vm/callhelpers.h:458
00007FFEEFBFE920 0000000101915E30 libcoreclr.dylib!RunStartupHooks() + 48 at /Users/directhex/Projects/runtime/src/coreclr/vm/assembly.cpp:1607
00007FFEEFBFEA20 000000010191564F libcoreclr.dylib!Assembly::ExecuteMainMethod(REF<PtrArray>*, int) + 319 at /Users/directhex/Projects/runtime/src/coreclr/vm/assembly.cpp:1659
00007FFEEFBFED30 00000001019B3499 libcoreclr.dylib!CorHost2::ExecuteAssembly(unsigned int, char16_t const*, int, char16_t const**, unsigned int*) + 2265 at /Users/directhex/Projects/runtime/src/coreclr/vm/corhost.cpp:384
00007FFEEFBFF030 00000001018D713D libcoreclr.dylib!coreclr_execute_assembly + 349 at /Users/directhex/Projects/runtime/src/coreclr/dlls/mscoree/unixinterface.cpp:446
00007FFEEFBFF120 0000000100005326 corerun!run(configuration const&) + 2678 at /Users/directhex/Projects/runtime/src/coreclr/hosts/corerun/corerun.cpp:358
00007FFEEFBFF5B0 000000010000390B corerun!main + 203 at /Users/directhex/Projects/runtime/src/coreclr/hosts/corerun/corerun.cpp:509
00007FFEEFBFF650 00007FFF72947CC9 libdyld.dylib!start + 1```

@directhex
Copy link
Member Author

I haven't made anything actually work

but

at least now anyone can repro, with ./build.sh -arch x64 -os MacCatalyst -subset clr+libs+libs.tests and DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true CORE_ROOT=/Users/directhex/Projects/runtime/artifacts/bin/testhost/net6.0-MacCatalyst-Debug-x64/shared/Microsoft.NETCore.App/6.0.0/ CORE_LIBRARIES=/Users/directhex/Projects/runtime/artifacts/bin/testhost/net6.0-MacCatalyst-Debug-x64/shared/Microsoft.NETCore.App/6.0.0/ /Users/directhex/Projects/runtime/artifacts/bin/testhost/net6.0-MacCatalyst-Debug-x64/shared/Microsoft.NETCore.App/6.0.0/corerun /path/to/helloworld.dll

@directhex
Copy link
Member Author

If you feel spicy, you can add codesign --verbose --entitlements src/mono/mono/mini/mac-entitlements.plist -f -s "-" artifacts/bin/testhost/net6.0-MacCatalyst-Debug-x64/shared/Microsoft.NETCore.App/6.0.0/corerun though it doesn't seem to have much effect

@lambdageek
Copy link
Member

Possibly to actually have the entitlements have any effect, you also need the hardened runtime option --options runtime to codesign

@directhex
Copy link
Member Author

This should now be working end-to-end locally, i.e. ./build.sh --os maccatalyst --arch x64 --subset clr+libs+libs.tests --test

Not plumbed into AzDO as of yet, but should work locally

Comment on lines 119 to 131
"RUNTIME_IDENTIFIER",
"APP_CONTEXT_BASE_DIRECTORY",
#if !defined(INVARIANT_GLOBALIZATION) && !TARGET_OS_MACCATALYST
"ICU_DAT_FILE_PATH"
#endif
};
const char *appctx_values [] = {
APPLE_RUNTIME_IDENTIFIER,
bundle,
#if !defined(INVARIANT_GLOBALIZATION) && !TARGET_OS_MACCATALYST
icu_dat_path
#endif
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it would hurt anything to add these to propertyKeys/propertyValues. they're literally the same thing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't really a conscious design decision not to. I took the Mono runtime.m, deleted all Mono-specific lines, and added lines to make CoreCLR work. I guess this ended up as vestigial.

@@ -186,6 +199,7 @@ public Xcode(string target, string arch)
cmakeLists = cmakeLists.Replace("%NativeLibrariesToLink%", toLink);
cmakeLists = cmakeLists.Replace("%AotSources%", aotSources);
cmakeLists = cmakeLists.Replace("%AotModulesSource%", string.IsNullOrEmpty(aotSources) ? "" : "modules.m");
cmakeLists = cmakeLists.Replace("%RpathResources%", "coreclr".Equals(runtimeFlavor, StringComparison.OrdinalIgnoreCase) ? "TRUE" : "FALSE");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It probably wouldn't hurt anything to do this for mono, also.

@marek-safar
Copy link
Contributor

@directhex should we close this one or do you want to land some common changes?

@directhex directhex closed this May 24, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
discussion NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) runtime-coreclr specific to the CoreCLR runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants