Hello Everyone,
We're building a .NET 8 application as a Snap using Snapcraft for amd64. We are using snapcraft.yaml and custom build scripts to prepare the app before packing.
We're encountering a persistent issue with .NET globalization support inside a Snap package. Despite multiple efforts to configure globalization correctly, the application continues to behave as though System.Globalization.Invariant mode is enabled, even when explicitly disabled.
Exception is:
[ERROR] Unable to create the database for station Module1. Error: Globalization Invariant Mode is not supported. System.NotSupportedException: Globalization Invariant Mode is not supported.
I would like to know,
Is there any Snapcraft-specific override that causes
.NETto default to Invariant mode despite config and environment setup?How can we ensure .NET respects full globalization behavior inside a Snap?
Are there best practices or working examples of .NET Snaps with ICU and full globalization working correctly?
Most importantly, since we have this issue, how to set SQL connection from snap to SQL server running in windows machine.
For your reference,
Her is what weโve tried so far:
Patched runtimeconfig.json
We programmatically update the config to include:
"System.Globalization.Invariant": falseThis change is confirmed in the final Snap package.
Installed ICU libraries
Installed ICU with: sudo apt-get install -y libicu70
Also tried including libicu in stage-packages in snapcraft.yaml.
Checked for Environment Variables
Ensured DOTNET_SYSTEM_GLOBALIZATION_INVARIANT is not set to true.
Tried manually setting it to false within Snap environment and launcher script.
Used custom command-chain or launcher script
Attempted to set environment variables via a wrapper shell script to ensure runtime uses full ICU support.
Validated Snap confinement behavior
Tested with both strict and devmode confinement.
Observed same behavior in both: app still acts as if invariant mode is enabled.
Reviewed snapcraft.yaml layout and environment
Verified whether ICU files are properly staged and accessible.
Used ADO.net instead of using EF Core but no effect.
Any guidance, working snapcraft.yaml samples, or even insights into .NET-Snap internals would be greatly appreciated.
Thanks in advance.