Closed semyonc closed 2 years ago
The issue is fixed by changing module.onRuntimeInitialized = () => MONO.mono_wasm_setenv('DOTNET_SYSTEM_GLOBALIZATION_INVARIANT', '1'); with the module.onRuntimeInitialized = () => { MONO.mono_wasm_setenv('DOTNET_SYSTEM_GLOBALIZATION_INVARIANT', '1'); MONO.mono_wasm_setenv('DOTNET_SYSTEM_GLOBALIZATION_PREDEFINED_CULTURES_ONLY', '0'); }; in the blazorWorker.js.
What's the reason of using hard-coded DOTNET_SYSTEM_GLOBALIZATION_INVARIANT = 1 in this place? See also, Culture creation and case mapping in globalization-invariant mode at the MS docs
Hello! Thank you for your feedback.
What's the reason of using hard-coded DOTNET_SYSTEM_GLOBALIZATION_INVARIANT = 1 in this place?
The fact that it's hardcoded was overlooked when migrating these lines from the net6.0 Mono Platform:
I started out replicating the resourceLoader but it turned out to be very complicated so I kind of dropped it but this line remained. So I agree, this is a problem, the line isn't really supposed to be there, at least not hardcoded.
Your suggestion is that I add DOTNET_SYSTEM_GLOBALIZATION_PREDEFINED_CULTURES_ONLY=false
, OK so that's an option I guess. But if I choose between adding code and removing, I sure would go for removal of the line
What do you think?
I absolutely agree, it’s better if there are no specific reasons for using it. I will check in my project too and provide the feedback
Unfortunately, it's not worked without DOTNET_SYSTEM_GLOBALIZATION_INVARIANT = 1 in my case, error at the initialization.
I have decided to parametrize the environment variables, so it can work for you with a config similar to the one you provided. As I'm hesitant to provide a non-standard value for the DOTNET_SYSTEM_GLOBALIZATION_PREDEFINED_CULTURES_ONLY value.
An attempt to get CultureInfo with System.Globalization.CultureInfo.GetCultureInfo(String name) throws exception "Only the invariant culture is supported in globalization-invariant mode" in the WorkerService (net 6.0)