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

NativeAOT: implement better logic for finding the icu data file #18471

Closed
Tracked by #17339
rolfbjarne opened this issue Jun 20, 2023 · 2 comments
Closed
Tracked by #17339

NativeAOT: implement better logic for finding the icu data file #18471

rolfbjarne opened this issue Jun 20, 2023 · 2 comments
Assignees
Labels
enhancement The issue or pull request is an enhancement
Milestone

Comments

@rolfbjarne
Copy link
Member

rolfbjarne commented Jun 20, 2023

Ref: 6d2e0b5 (#17374)

Once this dotnet/runtime fix reaches us:

https://github.com/dotnet/runtime/pull/87813

We should revert it, and instead set the ICU_DAT_FILE_PATH property in the runtime config to the relative path inside the app bundle.

That would probably be something like:

<ItemGroup>
    <RuntimeHostConfigurationOption Include="ICU_DAT_FILE_PATH" Value="Contents/MonoBundle/icudt.dat" />
</RuntimeHostConfigurationOption>

We could probably do that for all architectures, and remove the current ICU_DAT_FILE_PATH logic in runtime.m

@rolfbjarne rolfbjarne added the enhancement The issue or pull request is an enhancement label Jun 20, 2023
@rolfbjarne rolfbjarne added this to the .NET 8 milestone Jun 20, 2023
@rolfbjarne rolfbjarne changed the title NativeAOT: NativeAOT: implement better logic for finding the icu data file Jun 20, 2023
@lemonmojo
Copy link

@rolfbjarne @filipnavara

I'm the maintainer of Beyond.NET and am currently looking into fixing this.

Now I am able to get a NativeAOT'd library to correctly locate the icudt.dat in an iOS app bundle.
However, I can't get it to work when running an XCTest bundle. Looking at the fix you mentioned this seems to be implemented using -[NSBundle mainBundle]. So while this works for an app bundle, it unfortunately yields an incorrect path in a XCTest bundle and in turn fails to load the icudt.dat.

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

So while the current fix is good, it's not a silver bullet.
Unfortunately I currently have no good idea for how this can be implemented in a generic way that also supports XCTest bundles.

@ivanpovazan
Copy link
Contributor

Fixed with bf77022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue or pull request is an enhancement
Projects
None yet
Development

No branches or pull requests

3 participants