Skip to content

Path for ICU_DAT_FILE_PATH when targeting iOS inside an XCTest bundle #88835

@lemonmojo

Description

@lemonmojo

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:

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.
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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions