runtime icon indicating copy to clipboard operation
runtime copied to clipboard

System.Globalization.CultureInfo.CurrentCulture returns InvariantCulture on iOS

Open softlion opened this issue 2 years ago • 3 comments

Description

System.Globalization.CultureInfo.CurrentCulture returns InvariantCulture on iOS instead of the current culture.

It works as expected on Android.

Reproduction Steps

Run this on an iOS DEVICE (not a simulator) in debug mode.
Use a breakpoint to read the value and examine its content.

public static MauiApp CreateMauiApp()
{
     var culture = System.Globalization.CultureInfo.CurrentCulture;
    ...
}

Expected behavior

returns the culture set on the phone

Actual behavior

returns invariant culture

Regression?

yes, it was working on xamarin

Known Workarounds

No response

Configuration

ios 15.4.446-ci.-release-6-0-4xx.446/6.0.400 SDK 6.0.400, VS 17.3.32728.150

Other information

No response

softlion avatar Aug 06 '22 08:08 softlion

Tagging subscribers to this area: @dotnet/area-system-globalization See info in area-owners.md if you want to be subscribed.

Issue Details

Description

System.Globalization.CultureInfo.CurrentCulture returns InvariantCulture on iOS instead of the current culture.

It works as expected on Android.

Reproduction Steps

Run this on an iOS DEVICE (not a simulator) in debug mode.
Use a breakpoint to read the value and examine its content.

public static MauiApp CreateMauiApp()
{
     var culture = System.Globalization.CultureInfo.CurrentCulture;
    ...
}

Expected behavior

returns the culture set on the phone

Actual behavior

returns invariant culture

Regression?

yes, it was working on xamarin

Known Workarounds

No response

Configuration

ios 15.4.446-ci.-release-6-0-4xx.446/6.0.400 SDK 6.0.400, VS 17.3.32728.150

Other information

No response

Author: softlion
Assignees: -
Labels:

area-System.Globalization

Milestone: -

msftbot[bot] avatar Aug 06 '22 08:08 msftbot[bot]

Tagging subscribers to 'os-ios': @steveisok, @akoeplinger See info in area-owners.md if you want to be subscribed.

Issue Details

Description

System.Globalization.CultureInfo.CurrentCulture returns InvariantCulture on iOS instead of the current culture.

It works as expected on Android.

Reproduction Steps

Run this on an iOS DEVICE (not a simulator) in debug mode.
Use a breakpoint to read the value and examine its content.

public static MauiApp CreateMauiApp()
{
     var culture = System.Globalization.CultureInfo.CurrentCulture;
    ...
}

Expected behavior

returns the culture set on the phone

Actual behavior

returns invariant culture

Regression?

yes, it was working on xamarin

Known Workarounds

No response

Configuration

ios 15.4.446-ci.-release-6-0-4xx.446/6.0.400 SDK 6.0.400, VS 17.3.32728.150

Other information

No response

Author: softlion
Assignees: -
Labels:

area-System.Globalization, untriaged, os-ios

Milestone: -

msftbot[bot] avatar Aug 06 '22 11:08 msftbot[bot]

@steveisok could you please have a look and triage this issue? Thanks!

tarekgh avatar Aug 07 '22 21:08 tarekgh

Please god, send some help

Steven-L-42 avatar Aug 08 '22 15:08 Steven-L-42

@akoeplinger Please triage.

steveisok avatar Aug 08 '22 15:08 steveisok

This is a duplicate of https://github.com/dotnet/runtime/issues/68321. It was fixed in the 6.0.6 runtime release.

There is however a separate issue that causes the 6.0.400 dotnet SDK to only pull down the 6.0.5 runtime release for Maui workloads (you can check by looking at the <appname>.runtimeconfig.json in the publish folder and see that it references Microsoft.NETCore.App version 6.0.5).

One workaround is to use the 6.0.303 SDK (you can download it at https://dotnet.microsoft.com/en-us/download/dotnet/6.0) with this global.json in the root of your project:

{
  "sdk": {
    "version": "6.0.303"
  }
}

Once you have that you can run dotnet workload update to get the newer runtime release.

akoeplinger avatar Aug 12 '22 19:08 akoeplinger

@akoeplinger do you know if the machine used to install the workloads was a windows admin install or another install? the admin installs had an issue in 6.0.400 where the worklaods had to be updated multiple times to get the right ones so I wonder if it this was that issue: https://github.com/dotnet/core/blob/a696def5051c585cd380c4c9c0bcb447ae9a3fec/release-notes/6.0/known-issues.md#1-windows-admin-installs-of-the-net-60400-sdk-will-not-correctly-update-net-sdk-optional-workloads

marcpopMSFT avatar Aug 22 '22 20:08 marcpopMSFT

@marcpopMSFT no, I'm hitting it on my macOS machine as well

akoeplinger avatar Aug 22 '22 20:08 akoeplinger

Can you run dotnet workload update --print-rollback and dotnet workload update --print-download-link-only and share the output of both? Neither should actually change the current state of your system.

marcpopMSFT avatar Aug 22 '22 21:08 marcpopMSFT

@marcpopMSFT

$ dotnet workload update --print-rollback
==workloadRollbackDefinitionJsonOutputStart==
{
  "microsoft.net.sdk.tvos": "15.4.447/6.0.400",
  "microsoft.net.sdk.android": "32.0.448/6.0.400",
  "microsoft.net.sdk.maui": "6.0.486/6.0.400",
  "microsoft.net.sdk.macos": "12.3.447/6.0.400",
  "microsoft.net.workload.emscripten": "6.0.4/6.0.400",
  "microsoft.net.sdk.maccatalyst": "15.4.447/6.0.400",
  "microsoft.net.sdk.ios": "15.4.447/6.0.400",
  "microsoft.net.workload.mono.toolchain": "6.0.5/6.0.400"
}
==workloadRollbackDefinitionJsonOutputEnd==
$ dotnet workload update --print-download-link-only
Manifest package not resolved. Manifest package or URL for microsoft.net.workload.emscripten.manifest-6.0.400 doesn't exist.
Manifest package not resolved. Manifest package or URL for microsoft.net.workload.mono.toolchain.manifest-6.0.400 doesn't exist.
Skipping NuGet package signature verification.
==allPackageLinksJsonOutputStart==
[
  "https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.tvos.manifest-6.0.400/15.4.447/microsoft.net.sdk.tvos.manifest-6.0.400.15.4.447.nupkg",
  "https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.android.manifest-6.0.400/32.0.448/microsoft.net.sdk.android.manifest-6.0.400.32.0.448.nupkg",
  "https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.maui.manifest-6.0.400/6.0.486/microsoft.net.sdk.maui.manifest-6.0.400.6.0.486.nupkg",
  "https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.macos.manifest-6.0.400/12.3.447/microsoft.net.sdk.macos.manifest-6.0.400.12.3.447.nupkg",
  "https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.maccatalyst.manifest-6.0.400/15.4.447/microsoft.net.sdk.maccatalyst.manifest-6.0.400.15.4.447.nupkg",
  "https://api.nuget.org/v3-flatcontainer/microsoft.net.sdk.ios.manifest-6.0.400/15.4.447/microsoft.net.sdk.ios.manifest-6.0.400.15.4.447.nupkg"
]
==allPackageLinksJsonOutputEnd==

akoeplinger avatar Aug 23 '22 10:08 akoeplinger

Did you install a preview of 6.0.400 by any chance earlier on that machine and is it still around? This looks like https://github.com/dotnet/installer/pull/14134. Go into the dotnet/sdk-manifests/6.0.400 folder. You should see two workload manifests in that folder for mono and empscripten and they should be in a 6.0.300 folder instead. We fixed this in 6.0.400 GA but didn't have a way of fixing folks who had already installed a preview in the same location.

For September, we'll be releasing 6.0.400 versions of both of those which should fix anyone still in this state.

marcpopMSFT avatar Aug 23 '22 20:08 marcpopMSFT

Yeah I'm pretty sure I had 6.0.400 previews installed. @softlion you too?

The folder indeed has an older version of these two manifests: image

If I remove them the problem is fixed :)

akoeplinger avatar Aug 23 '22 20:08 akoeplinger

Glad we tracked that down and good to know it'll be fixed as soon as we publish our 6.0.9 release in September.

marcpopMSFT avatar Aug 23 '22 22:08 marcpopMSFT