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] fix .resx files in apps #9905

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jonathanpeppers
Copy link
Member

The EmbeddedResources_ShouldBeLocalized() test was failing under a NativeAOT context:

Embedded string resource did not contain expected value after changing CultureInfo.
String lengths are both 1. Strings differ at index 0.
Expected: "b"
But was:  "a"
-----------^

After reviewing a .binlog, it appears the _ComputeIlcCompileInputs MSBuild target was not working as expected:

https://github.com/dotnet/runtime/blob/cc803458ab4dabf020b462873be5bf56f1640b1e/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets#L3-L11

@(IntermediateSatelliteAssembliesWithTargetPath) was blank!

The problem being the way Android has an "inner" build per RID:

  • @(IntermediateSatelliteAssembliesWithTargetPath) is set in the "outer" build.

  • @(IntermediateSatelliteAssembliesWithTargetPath) is blank in the "inner" build per RID.

  • The "inner" build is where the ILC compiler runs, and so it doesn't see the current project's *.resource.dll file.

To fix this, we can pass $(_OuterIntermediateSatelliteAssembliesWithTargetPath) into the inner build.

I updated an MSBuild test to run normally and in a NativeAOT context.

The `EmbeddedResources_ShouldBeLocalized()` test was failing under a
NativeAOT context:

    Embedded string resource did not contain expected value after changing CultureInfo.
    String lengths are both 1. Strings differ at index 0.
    Expected: "b"
    But was:  "a"
    -----------^

After reviewing a `.binlog`, it appears the `_ComputeIlcCompileInputs`
MSBuild target was not working as expected:

https://github.com/dotnet/runtime/blob/cc803458ab4dabf020b462873be5bf56f1640b1e/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets#L3-L11

`@(IntermediateSatelliteAssembliesWithTargetPath)` was blank!

The problem being the way Android has an "inner" build per RID:

* `@(IntermediateSatelliteAssembliesWithTargetPath)` is set in the
  "outer" build.

* `@(IntermediateSatelliteAssembliesWithTargetPath)` is blank in the
  "inner" build per RID.

* The "inner" build is where the ILC compiler runs, and so it doesn't
  see the current project's `*.resource.dll` file.

To fix this, we can pass `$(_OuterIntermediateSatelliteAssembliesWithTargetPath)`
into the inner build.

I updated an MSBuild test to run normally and in a NativeAOT context.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants