-
Notifications
You must be signed in to change notification settings - Fork 555
[nativeaot] fix .resx
files in apps
#9905
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
Conversation
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.
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs
Outdated
Show resolved
Hide resolved
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/PackagingTest.cs
Outdated
Show resolved
Hide resolved
IsRelease = value; | ||
// Only toggle IsRelease=true when value is true | ||
if (value) | ||
IsRelease = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I want to say unit test a NativeAOT app in debug mode is this going to stop that from working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would maybe still test Release
configuration and set $(DebugType)
and $(DebugSymbols)
.
Eventually, I think $(PublishAot)=true
in Debug mode will still use Mono (or CoreCLR), so our managed debuggers will work.
The
EmbeddedResources_ShouldBeLocalized()
test was failing under a NativeAOT context: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.