Uh oh!
There was an error while loading. Please reload this page.
Return iOS version in Environment.OSVersion on Mac Catalyst - #50990
Conversation
Implement OperatingSystem.IsMacCatalyst and OperatingSystem.IsMacCatalystVersionAtLeast.
ghost
commented
Apr 9, 2021
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| const char* SystemNative_iOSSupportVersion() | ||
| { | ||
| @autoreleasepool |
There was a problem hiding this comment.
why do we need an autoreleasepool here?
There was a problem hiding this comment.
I am not necessarily sure whether it's needed or not but LLVM code has it there (https://github.com/llvm/llvm-project/blob/62ec4ac90738a5f2d209ed28c822223e58aaaeb7/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm#L83-L90).
There was a problem hiding this comment.
yeah I saw that, I was mostly wondering because we have some custom code in pal_autoreleasepool.m that does thread initialization stuff used by ThreadPool code in managed and I don't know if we need that here too:
runtime/src/libraries/Native/Unix/System.Native/pal_autoreleasepool.m
Lines 18 to 35 in 5b683e2
@rolfbjarne do you know the implications?
There was a problem hiding this comment.
Good point. I'm no expert on that but the documentation really suggests that it may be necessary... 🤷🏻♂️
There was a problem hiding this comment.
That's fine [1] if the new API are called from user+managed code.
If the dotnet runtime(s) calls (independently or before xamarin's runtime completed it's initialization) SystemNative_iOSSupportVersion then SystemNative_CreateAutoreleasePool should be called first (or to create the instance).
[1] if not it means we need to fix it
There was a problem hiding this comment.
I'll modify it to call SystemNative_CreateAutoreleasePool instead of @autoreleasepool which should be safe. The code should not depend on Xamarin runtime being used/initialized (even if in most cases it will be).
There was a problem hiding this comment.
The Apple documentation says that using NSAutoreleasePool manually would trip the ARC analyzer so I just extracted the code into helper method and kept using @autoreleasepool.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
22bfbb5 to
40b91bcCompare0ab51c0 to
911d385Compare
Implement OperatingSystem.IsMacCatalyst and OperatingSystem.IsMacCatalystVersionAtLeast
Fixes#47768