Closed devrandomzero closed 1 year ago
cc @jbevain
In this case, it is not related to our Unity extension.
The .NET server part is crashing getting CultureInfo.GetCultureInfo(locale)
with a en-us
locale, coming from VSCODE_NLS_CONFIG
@devrandomzero could you share your locale settings in VSCode, but also for your system-OS (like what are the regions/languages supported). Thank you!
It seems the associated runtime is running in invariant mode
in this case : https://aka.ms/GlobalizationInvariantMode
cc @jbevain
In this case, it is not related to our Unity extension.
The .NET server part is crashing getting
CultureInfo.GetCultureInfo(locale)
with aen-us
locale, coming fromVSCODE_NLS_CONFIG
@devrandomzero could you share your locale settings in VSCode, but also for your system-OS (like what are the regions/languages supported). Thank you!
It seems the associated runtime is running in
invariant mode
in this case : https://aka.ms/GlobalizationInvariantMode
Thank you @sailro, here's my system locale:
LC_CTYPE=en_US.utf8
LC_NUMERIC=it_IT.utf8
LC_TIME=it_IT.utf8
LC_COLLATE="it_IT.UTF-8"
LC_MONETARY=it_IT.utf8
LC_MESSAGES=en_US.utf8
LC_PAPER=it_IT.utf8
LC_NAME="it_IT.UTF-8"
LC_ADDRESS="it_IT.UTF-8"
LC_TELEPHONE="it_IT.UTF-8"
LC_MEASUREMENT=it_IT.utf8
LC_IDENTIFICATION="it_IT.UTF-8"
LC_ALL=
VSCode
Hope is enough Thanks
I have the same issue except I am not using Unity. I am using Remote-SSH to a RHEL 7.9 machine. When the C# DevKit extension activates, I get the exact same error. We are using Invariant mode for globalization, i.e. DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1.
I have the same issue except I am not using Unity. I am using Remote-SSH to a RHEL 7.9 machine. When the C# DevKit extension activates, I get the exact same error. We are using Invariant mode for globalization, i.e. DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1.
Yes I think that is the root issue, the C# Dev Kit server-part should handle that the associated runtime is setup for invariant culture, providing at least a fallback to a default culture when hitting such a CultureNotFoundException
.
It seems there is not current API for detecting this invariant mode: https://stackoverflow.com/questions/75298957/how-to-detect-globalization-invariant-mode
But an API proposal was submitted: https://github.com/dotnet/runtime/issues/81429
cc @AArnott for awareness.
What is the purpose for setting DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
? Would it defeat the purpose if we cleared that environment variable when spawning the .NET server process?
What is the purpose for setting
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
? Would it defeat the purpose if we cleared that environment variable when spawning the .NET server process?
From what I understand, specific Linux distributions are made to be super small like Alpine
, without ICU installed by default and .NET
requires icu-libs
for globalization support.
That's why this flag was introduced to allow the .NET runtime to work on those systems knowing the drawback will be poor globalization support.
Microsoft is even offering Docker files for .NET
/Alpine
with this flag explicitly set:
https://github.com/dotnet/dotnet-docker/blob/main/src/aspnet/7.0/alpine3.18/amd64/Dockerfile#L4
So clearing DOTNET_SYSTEM_GLOBALIZATION_INVARIANT
before spawning will change nothing, we probably do not have support for globalization at the os-level anyway.
@devrandomzero @sean-jost do you have a similar use case ?
Thanks. The next prerelease will swallow this exception.
@sailro It is very strange because when I query locale settings via localectl status
it shows me _enUS.UTF-8, and when simply ssh to the server via command line I have DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=0, but when I use remote-ssh extension in VS Code it is set to 1. Even with no other extensions in use.
@sailro I've also tried to set in my env DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=0 but the problem persists.
The next prerelease
... or maybe next week's. We're having some trouble with some other changes and they may cause this fix to not quite make this week's release.
Hi, any news about this?
Thank you
Hi, any news about this?
Thank you
It should be released, make sure you are using pre-releases (go to Extensions, C# Dev Kit and click Switch to Pre-Release version)
Hi, I'm still getting errors, when starting vscode I get this message in the console:
[Info - 6:55:08 PM] [Program] Language server initialized [Warn - 6:55:08 PM] [LanguageServerHost] Culture en was not found, falling back to OS culture
Then sometimes when I try to use the autocomplete function I get this error
[Error - 6:55:33 PM] [LanguageServerHost] System.TypeInitializationException: The type initializer for 'Microsoft.CodeAnalysis.Completion.PatternMatchHelper' threw an exception. ---> System.Globalization.CultureNotFoundException: Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter 'name') en-US is an invalid culture identifier.
and a popup in the bottom right corner with this message
Request textDocument/completion failed.
VS Code = v1.82.2-1 C# Dev Kit = v0.5.98 IntelliCode for C# Dev Kit = v0.1.26
Thank you for your help
Indeed, it seems it was correctly fixed in C# Dev Kit by @AArnott (we just have a warning to track that a specific culture was not found).
But this line is wrong in Roslyn in the context of GlobalizationInvariantMode
:
https://github.com/dotnet/roslyn/blob/main/src/Features/Core/Portable/Completion/PatternMatchHelper.cs#L24
cc @CyrusNajmabadi and @genlu, for more context see https://github.com/microsoft/vscode-dotnettools/issues/386#issuecomment-1683423087
cc @jbevain
What is the right way to get the english culture (or some reasonable fallback culture) in that case?
@CyrusNajmabadi I think all you have is Invariant
, which uses the neutral culture for your assembly.
My question is more about how we determine that we're in that state. Is there an API for that?
On Fri, Sep 22, 2023, 17:22 Andrew Arnott @.***> wrote:
@CyrusNajmabadi https://github.com/CyrusNajmabadi I think all you have is Invariant, which uses the neutral culture for your assembly.
— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-dotnettools/issues/386#issuecomment-1732145136 or unsubscribe https://github.com/notifications/unsubscribe-auth/ABC2MY56H6ZGQLEGQI6F5PDX3YTVDBFKMF2HI4TJMJ2XIZLTS6BKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDUOJ2WLJDOMFWWLLTXMF2GG2C7MFRXI2LWNF2HTAVFOZQWY5LFUVUXG43VMWSG4YLNMWVXI2DSMVQWIX3UPFYGLAVFOZQWY5LFVI2DSOJWGY4DKMBSGKSG4YLNMWUWQYLTL5WGCYTFNSBKK5TBNR2WLKRVGU4TGNZYGUYDOMNENZQW2ZNJNBQXGX3MMFRGK3ECUV3GC3DVMWVDKNRQGE2DOMJYGE32I3TBNVS2S2DBONPWYYLCMVWIFJLWMFWHKZNKGU4DKMZRGQZTKNJTURXGC3LFVFUGC427NRQWEZLMVRZXKYTKMVRXIX3UPFYGLLCJONZXKZKDN5WW2ZLOOSTHI33QNFRXHFUCUR2HS4DFVJZGK4DPONUXI33SPGSXMYLMOVS2SNJYG44DMOJRHAZIFJDUPFYGLJLJONZXKZNFOZQWY5LFVIYTQNBYGQ3TONJTGGBKI5DZOBS2K3DBMJSWZJLWMFWHKZNKGQ4TSNRWHA2TAMRSQKSHI6LQMWSWYYLCMVWKK5TBNR2WLKRVGU4TGNZYGUYDOMMCUR2HS4DFUVWGCYTFNSSXMYLMOVS2UNJWGAYTINZRHAYTPAVEOR4XAZNFNRQWEZLMUV3GC3DVMWVDKOBVGMYTIMZVGUZ2O5DSNFTWOZLSUZRXEZLBORSQ . You are receiving this email because you were mentioned.
Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .
@CyrusNajmabadi check this comment https://github.com/microsoft/vscode-dotnettools/issues/386#issuecomment-1679033469
Ok. Opened https://github.com/dotnet/roslyn/pull/70096 as the poor-man's way of handling this.
Type: Bug
I'm using the new Unity extension with C# Dev Kit and as the title says the autocompletion doesn't work, I've tried to follow all the steps mentioned in this post and I think the problem is here:
3- Make sure C# Dev Kit is not displaying any error message
Here's the extension output:
Thanks
Extension version: 0.4.2 VS Code version: Code 1.81.1 (6c3e3dba23e8fadc360aed75ce363ba185c49794, 2023-08-09T22:18:39.991Z) OS version: Linux x64 6.4.9-arch1-1 Modes:
System Info
|Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz (8 x 3746)| |GPU Status|2d_canvas: enabledcanvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|1, 1, 0| |Memory (System)|15.58GB (11.96GB free)| |Process Argv|--unity-launch --crash-reporter-id c1843333-17d3-4f26-9a41-9d22f34a22f9| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|plasma| |XDG_CURRENT_DESKTOP|KDE| |XDG_SESSION_DESKTOP|KDE| |XDG_SESSION_TYPE|x11|
A/B Experiments
``` vsliv368:30146709 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593cf:30376535 pythonvs932:30410667 vsclangdf:30486550 c4g48928:30535728 dsvsc012:30540252 pynewext54:30695312 azure-dev_surveyone:30548225 vsccc:30803844 282f8724:30602487 89544117:30613380 showlangstatbar:30737416 03d35959:30757346 pythonfmttext:30731395 pythoncmv:30756943 fixshowwlkth:30771522 showindicator:30805244 pythongtdpath:30769146 i26e3531:30792625 gsofa:30804715 pythonnosmt12:30797651 pythonidxpt:30805730 pythonnoceb:30805159 synctok:30810529 dsvsc013:30795093 dsvsc014:30804076 ```