I've been working on making our .NET Core app use app-local ICU to avoid future inconsistencies, following Microsoft's documentation. Here’s the relevant part of our .csproj file:
enter code here
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.3" />
<InvariantGlobalization>true</InvariantGlobalization>
<ItemGroup>
<IcuAssemblies Include="icu\*.so*" />
<RuntimeTargetsCopyLocalItems Include="@(IcuAssemblies)" AssetType="native"
CopyLocal="true"
DestinationSubDirectory="runtimes/linux-x64/native/"
DestinationSubPath="%(FileName)%(Extension)"
RuntimeIdentifier="linux-x64" NuGetPackageId="Microsoft.ICU.ICU4C.Runtime" />
</ItemGroup>
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Globalization.UseNls"
Value="false" />
<RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu"
Value="72.1" />
</ItemGroup>
This setup works fine on Windows 10/11 and our build server running RHEL 9. However, when we deploy the app to Amazon Linux 2 (AL2), it crashes on startup. The journalctl log from systemd shows the following:
enter code here
test-server.internal myApp[2736]: at MyApp.Program.Main(String[] args) in
MyApp\Program.cs:line 15
test-server.internal systemd[1]: myApi.service: main process exited,
code=killed, status=6/ABRT
test-server.internal systemd[1]: Unit myApi.service entered failed state.
test-server.internal systemd[1]: myApi.service failed.
I also noticed other warnings/errors related to the systemd service file, but removing the ICU-related settings (RuntimeHostConfigurationOption) allows the app to run just fine. Here’s what I’ve already checked:
enter code here
[Unit]
Description=MyApp .NET Core WebApp
After=network.target
Wants=network.target
[Service]
WorkingDirectory=/path/to/app
ExecStart=/usr/bin/dotnet /path/to/app/MyApp.dll
Restart=always
RestartSec=10
Environment=ASPNETCORE_ENVIRONMENT=Training
Environment=ASPNETCORE_URLS=http://*:5000
[Install]
WantedBy=multi-user.target
Also I need to know What could cause the app to crash on Amazon Linux 2 with app-local ICU? and are there any extra steps or dependencies required for AL2 that aren’t mentioned in the Microsoft docs?