-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Path for ICU_DAT_FILE_PATH when targeting iOS inside an XCTest bundle #88835
Comments
This shouldn't be NativeAOT specific and happen on Mono as well, guess nobody tried that yet :) |
Tagging subscribers to 'os-ios': @steveisok, @akoeplinger, @kotlarmilos Issue DetailsDescriptionAs commented here the recently introduced change to relatively locate the icudt.dat file inside an app bundle works fine. However, when a NativeAOT'd library is included and called from an XCTest bundle, let mainPath = Bundle.main.bundlePath
// /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents
let testPath = Bundle(for: SomeTypeInTheTestBundle.self).bundlePath
// ~/Library/Developer/Xcode/DerivedData/TestBundle/Build/Products/Variant-ASan/Debug-iphonesimulator/TestBundle.xctest Of course this causes the load to fail because the icudt.dat will never be in Xcode's app bundle.
|
@akoeplinger I guess so. Unfortunately I currently have no idea what a proper fix might look like as the location of the file heavily depends on the project/bundle structure. I mean, even if Is there some way/hack to set the path at runtime? |
hmm not right now, we have the ICU_DAT_FILE_PATH app context key but NativeAOT compiles that into the app "hardcoded" during the build time. we could probably add an environment variable override. another idea might be calling |
@akoeplinger I can confirm that using I think it's still a good idea to change the loading code in the runtime to use |
@akoeplinger Any chance that the switch to |
@lemonmojo I was planning to but we recently hit an issue in our so called "library mode" where linking the runtime into two libraries causes an issue because of duplicate Objective-C classes and we got rid of the classes: #89956 So the I think the env var is the only good option we have left, do you think that'd still help or is the |
Actually, can you try setting |
For XCTest we could probably look at Alternatively we could make the build pass in the bundle identifier via AppContext and then use I wonder if the easiest solution is embedding the icudt.dat file itself somehow. |
@akoeplinger Sorry for the delay. I just tried setting the At least for my case, just looking at I'm not sure I understand your second suggestion regarding passing in the bundle identifier. Could you please elaborate? Is embedding the icudt.dat file a viable option at that level? If so, that would absolutely be the easiest approach from a .NET user's perspective. To be honest, I didn't even know what that file is and why it's required until I hit some issues because I wasn't embedding it. So yeah, if you can make that work I'd be awesome. |
Tagging subscribers to this area: @dotnet/area-system-globalization Issue DetailsDescriptionAs commented here the recently introduced change to relatively locate the icudt.dat file inside an app bundle works fine. However, when a NativeAOT'd library is included and called from an XCTest bundle, let mainPath = Bundle.main.bundlePath
// /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents
let testPath = Bundle(for: SomeTypeInTheTestBundle.self).bundlePath
// ~/Library/Developer/Xcode/DerivedData/TestBundle/Build/Products/Variant-ASan/Debug-iphonesimulator/TestBundle.xctest Of course this causes the load to fail because the icudt.dat will never be in Xcode's app bundle.
|
.NET 9 uses "hybrid globalization" on iOS which doesn't rely on bundling ICU with the app anymore so this should no longer be needed. |
Description
As commented here the recently introduced change to relatively locate the icudt.dat file inside an app bundle works fine.
However, when a NativeAOT'd library is included and called from an XCTest bundle,
-[NSBundle mainBundle]
returns a path inside Xcode instead of the test bundle:Of course this causes the load to fail because the icudt.dat will never be in Xcode's app bundle.
If the XCTest project is however set up to copy this file to it's bundle resources folder, it would be there waiting to be consumed by the .NET runtime but currently fails because the logic of locating it just targets the main bundle.
The text was updated successfully, but these errors were encountered: