Error in ColorPicker after deploy to IIS #1399

Closed
opened 2026-01-29 17:53:08 +00:00 by claunia · 17 comments
Owner

Originally created by @lulikin on GitHub (Sep 20, 2024).

There is nothing special. I use RadzenColorPicker in a way
<RadzenColorPicker Name="Color" class="w-100" @bind-Value="_StallCode.Color" />

Everything works in debug. But after I deploy my project to IIS, I get flowing error.
System.TypeInitializationException: TypeInitialization_Type, Radzen.Blazor.Rendering.RGB ---> System.PlatformNotSupportedException: PlatformNotSupported_HybridGlobalization, HashCode at System.Globalization.CompareInfo.GetHashCodeOfStringCore(ReadOnlySpan1 , CompareOptions )
at System.Globalization.CompareInfo.GetHashCode(ReadOnlySpan1 , CompareOptions ) at System.Globalization.CompareInfo.GetHashCode(String , CompareOptions ) at System.CultureAwareComparer.GetHashCode(String ) at System.Collections.Generic.Dictionary2.TryInsert(String , String , InsertionBehavior )
at System.Collections.Generic.Dictionary2[[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].set_Item(String , String ) at Radzen.Blazor.Rendering.RGB..cctor() Exception_EndOfInnerExceptionStack at Radzen.Blazor.RadzenColorPicker.SetInitialValue() at Radzen.Blazor.RadzenColorPicker.OnInitialized() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Radzen.RadzenComponent.SetParametersAsync(ParameterView parameters) at Radzen.Blazor.RadzenColorPicker.SetParametersAsync(ParameterView parameters)
Capture

Originally created by @lulikin on GitHub (Sep 20, 2024). There is nothing special. I use RadzenColorPicker in a way ` <RadzenColorPicker Name="Color" class="w-100" @bind-Value="_StallCode.Color" />` Everything works in debug. But after I deploy my project to IIS, I get flowing error. `System.TypeInitializationException: TypeInitialization_Type, Radzen.Blazor.Rendering.RGB ---> System.PlatformNotSupportedException: PlatformNotSupported_HybridGlobalization, HashCode at System.Globalization.CompareInfo.GetHashCodeOfStringCore(ReadOnlySpan`1 , CompareOptions ) at System.Globalization.CompareInfo.GetHashCode(ReadOnlySpan`1 , CompareOptions ) at System.Globalization.CompareInfo.GetHashCode(String , CompareOptions ) at System.CultureAwareComparer.GetHashCode(String ) at System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].TryInsert(String , String , InsertionBehavior ) at System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].set_Item(String , String ) at Radzen.Blazor.Rendering.RGB..cctor() Exception_EndOfInnerExceptionStack at Radzen.Blazor.RadzenColorPicker.SetInitialValue() at Radzen.Blazor.RadzenColorPicker.OnInitialized() at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() at Radzen.RadzenComponent.SetParametersAsync(ParameterView parameters) at Radzen.Blazor.RadzenColorPicker.SetParametersAsync(ParameterView parameters)` ![Capture](https://github.com/user-attachments/assets/86499471-7348-46fc-b64d-46a02af47b14)
Author
Owner

@enchev commented on GitHub (Sep 23, 2024):

In my opinion this error is caused by wrong .NET version installed on your IIS server - definitely not related to our component . You need to install .NET 8 Windows Hosting Bundle:
https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-8.0.8-windows-hosting-bundle-installer

@enchev commented on GitHub (Sep 23, 2024): In my opinion this error is caused by wrong .NET version installed on your IIS server - definitely not related to our component . You need to install .NET 8 Windows Hosting Bundle: https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-8.0.8-windows-hosting-bundle-installer
Author
Owner

@lulikin commented on GitHub (Sep 23, 2024):

Thank you for reply mr. enchev. I think that error has something to do with color parsing and localization. I use many radzen components in this poject (menu, grid, editors, dropdowns,..), but only color component show error.
I will try to give you specific line of source in the following week.
Gregor

@lulikin commented on GitHub (Sep 23, 2024): Thank you for reply mr. enchev. I think that error has something to do with color parsing and localization. I use many radzen components in this poject (menu, grid, editors, dropdowns,..), but only color component show error. I will try to give you specific line of source in the following week. Gregor
Author
Owner

@nicoarm93 commented on GitHub (Oct 30, 2024):

I have also encountered this problem after deploying the app on IIS (it worked fine on my PC).
The problem should be caused in the RGB class, when the dictionary is called with the StringComparer.InvariantCultureIgnoreCase.

In this link https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-hybrid-mode.md is mentioned that there is a breaking change with the GetHashCode method.

To solve this i have added these configurations

<PropertyGroup>
   <HybridGlobalization>false</HybridGlobalization>
   <InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>

to my .csproj and now I don't get the exception anymore.

Hope this is useful.

@nicoarm93 commented on GitHub (Oct 30, 2024): I have also encountered this problem after deploying the app on IIS (it worked fine on my PC). The problem should be caused in the RGB class, when the dictionary is called with the `StringComparer.InvariantCultureIgnoreCase`. In this link https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-hybrid-mode.md is mentioned that there is a breaking change with the `GetHashCode` method. To solve this i have added these configurations ``` <PropertyGroup> <HybridGlobalization>false</HybridGlobalization> <InvariantGlobalization>true</InvariantGlobalization> </PropertyGroup> ``` to my .csproj and now I don't get the exception anymore. Hope this is useful.
Author
Owner

@lulikin commented on GitHub (Nov 2, 2024):

It doesn't work. I get error
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.
at System.Globalization.CultureInfo.GetCultureInfo(String name)
at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry, SqlConnectionOverrides overrides) at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides) at Microsoft.Data.SqlClient.SqlConnection.Open() at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.OpenDbConnection(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternal(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.Enumerator.InitializeReader(Enumerator
enumerator)
at
Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.Enumerator.<>c.<MoveNext>b__21_0(DbContext _, Enumerator enumerator) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func3 operation, Func3 verifySucceeded) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable1.Enumerator.MoveNext()

V V sre., 30. okt. 2024 ob 12:22 je oseba nick @.***>
napisala:

I have also encountered this problem after deploying the app on IIS (it
worked fine on my PC).
The problem should be caused in the RGB class, when the dictionary is
called with the StringComparer.InvariantCultureIgnoreCase.

In this link
https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-hybrid-mode.md
is mentioned that there is a breaking change with the GetHashCode method.

To solve this i have added these configurations

false true

to my .csproj and now I don't get the exception anymore.

Hope this is useful.


Reply to this email directly, view it on GitHub
https://github.com/radzenhq/radzen-blazor/issues/1705#issuecomment-2446693366,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AJOAT7HVDPQSJ6GSXE756WTZ6C6PDAVCNFSM6AAAAABOSWMEXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBWGY4TGMZWGY
.
You are receiving this because you authored the thread.Message ID:
@.***>

@lulikin commented on GitHub (Nov 2, 2024): It doesn't work. I get error 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. at System.Globalization.CultureInfo.GetCultureInfo(String name) at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides) at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides) at Microsoft.Data.SqlClient.SqlConnection.Open() at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.OpenDbConnection(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternal(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.InitializeReader(Enumerator enumerator) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.<>c.<MoveNext>b__21_0(DbContext _, Enumerator enumerator) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded) at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.Enumerator.MoveNext() V V sre., 30. okt. 2024 ob 12:22 je oseba nick ***@***.***> napisala: > I have also encountered this problem after deploying the app on IIS (it > worked fine on my PC). > The problem should be caused in the RGB class, when the dictionary is > called with the StringComparer.InvariantCultureIgnoreCase. > > In this link > https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-hybrid-mode.md > is mentioned that there is a breaking change with the GetHashCode method. > > To solve this i have added these configurations > > <PropertyGroup> > <HybridGlobalization>false</HybridGlobalization> > <InvariantGlobalization>true</InvariantGlobalization> > </PropertyGroup> > > to my .csproj and now I don't get the exception anymore. > > Hope this is useful. > > — > Reply to this email directly, view it on GitHub > <https://github.com/radzenhq/radzen-blazor/issues/1705#issuecomment-2446693366>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AJOAT7HVDPQSJ6GSXE756WTZ6C6PDAVCNFSM6AAAAABOSWMEXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBWGY4TGMZWGY> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> >
Author
Owner

@akorchev commented on GitHub (Nov 4, 2024):

We will try to not use new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase) with the next release. Hopefully it fixes the issue.

@akorchev commented on GitHub (Nov 4, 2024): We will try to not use `new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase)` with the next release. Hopefully it fixes the issue.
Author
Owner

@lulikin commented on GitHub (Nov 4, 2024):

Cool, thanks for the heads up!

On Mon, 4 Nov 2024, 08:18 Atanas Korchev, @.***> wrote:

We will try to not use new Dictionary<string,
string>(StringComparer.InvariantCultureIgnoreCase) with the next release.
Hopefully it fixes the issue.


Reply to this email directly, view it on GitHub
https://github.com/radzenhq/radzen-blazor/issues/1705#issuecomment-2453966988,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AJOAT7ARKVOY6IAK4OQK3W3Z64NTLAVCNFSM6AAAAABOSWMEXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJTHE3DMOJYHA
.
You are receiving this because you authored the thread.Message ID:
@.***>

@lulikin commented on GitHub (Nov 4, 2024): Cool, thanks for the heads up! On Mon, 4 Nov 2024, 08:18 Atanas Korchev, ***@***.***> wrote: > We will try to not use new Dictionary<string, > string>(StringComparer.InvariantCultureIgnoreCase) with the next release. > Hopefully it fixes the issue. > > — > Reply to this email directly, view it on GitHub > <https://github.com/radzenhq/radzen-blazor/issues/1705#issuecomment-2453966988>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AJOAT7ARKVOY6IAK4OQK3W3Z64NTLAVCNFSM6AAAAABOSWMEXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJTHE3DMOJYHA> > . > You are receiving this because you authored the thread.Message ID: > ***@***.***> >
Author
Owner

@Trapulo commented on GitHub (Dec 13, 2024):

I'm running 5.6.15 and I have the error PlatformNotSupported_HybridGlobalization

System.TypeInitializationException: TypeInitialization_Type, Radzen.Blazor.Rendering.RGB
---> System.PlatformNotSupportedException: PlatformNotSupported_HybridGlobalization

@Trapulo commented on GitHub (Dec 13, 2024): I'm running 5.6.15 and I have the error PlatformNotSupported_HybridGlobalization System.TypeInitializationException: TypeInitialization_Type, Radzen.Blazor.Rendering.RGB ---> System.PlatformNotSupportedException: PlatformNotSupported_HybridGlobalization
Author
Owner

@SOSHsbaker commented on GitHub (Dec 27, 2024):

We've been banging our head against this one and can't seem to figure out a fix.

Adding the following lines may have fixed that issue, but it caused our dollar signs '$' to be replaced with '¤' everywhere we use ".ToString("c")".

<HybridGlobalization>false</HybridGlobalization>
<InvariantGlobalization>true</InvariantGlobalization>
@SOSHsbaker commented on GitHub (Dec 27, 2024): We've been banging our head against this one and can't seem to figure out a fix. Adding the following lines may have fixed that issue, but it caused our dollar signs '$' to be replaced with '¤' everywhere we use ".ToString("c")". ``` <HybridGlobalization>false</HybridGlobalization> <InvariantGlobalization>true</InvariantGlobalization> ```
Author
Owner

@akorchev commented on GitHub (Dec 27, 2024):

Please tell us how to reproduce the issue so we can fix it once and for all. What kind of app do you have (server, wasm, auto rendering, wasm standalone)? Which .NET version?

@akorchev commented on GitHub (Dec 27, 2024): Please tell us how to reproduce the issue so we can fix it once and for all. What kind of app do you have (server, wasm, auto rendering, wasm standalone)? Which .NET version?
Author
Owner

@SOSHrspitz commented on GitHub (Dec 27, 2024):

I am working on the same project that SOSHsbaker is:

To reproduce you have to create a project with both a color picker and a html field that displays a formatted currency string using ".ToString("C")" then add

<HybridGlobalization>false</HybridGlobalization>
<InvariantGlobalization>true</InvariantGlobalization>

Color picker will throw an error unless InvariantGlobalization is true but that then turns the currency symbol in the formatted string into a default currency symbol instead of one that relates to our location.

App Type: Server
.NET Version: 8.0.11

@SOSHrspitz commented on GitHub (Dec 27, 2024): I am working on the same project that SOSHsbaker is: To reproduce you have to create a project with both a color picker and a html field that displays a formatted currency string using ".ToString("C")" then add ``` <HybridGlobalization>false</HybridGlobalization> <InvariantGlobalization>true</InvariantGlobalization> ``` Color picker will throw an error unless InvariantGlobalization is true but that then turns the currency symbol in the formatted string into a default currency symbol instead of one that relates to our location. App Type: Server .NET Version: 8.0.11
Author
Owner

@akorchev commented on GitHub (Dec 27, 2024):

I think the currency formatting is expected to be a square with invariant culture. This is beyond our control. Please tell me how to reproduce the ColorPicker exception.

@akorchev commented on GitHub (Dec 27, 2024): I think the currency formatting is expected to be a square with invariant culture. This is beyond our control. Please tell me how to reproduce the ColorPicker exception.
Author
Owner

@akorchev commented on GitHub (Dec 27, 2024):

I created a test Blazor Server app which targets .NET 8.x and I can't reproduce this problem. Here is the test app.
ColorPickerApp.zip

@akorchev commented on GitHub (Dec 27, 2024): I created a test Blazor Server app which targets .NET 8.x and I can't reproduce this problem. Here is the test app. [ColorPickerApp.zip](https://github.com/user-attachments/files/18262751/ColorPickerApp.zip)
Author
Owner

@SOSHrspitz commented on GitHub (Dec 27, 2024):

The issue seems to be occuring upon converting hex codes to RGB and vice versa using "Radzen.Blazor.Rendering.RGB.Parse(Value).ToCSS();"
or
"Radzen.Blazor.Rendering.RGB.Parse(Value).ToHex();"

We made a project and used HTML 5 color picker instead but still used those functions and the issue still remained.

@SOSHrspitz commented on GitHub (Dec 27, 2024): The issue seems to be occuring upon converting hex codes to RGB and vice versa using "Radzen.Blazor.Rendering.RGB.Parse(Value).ToCSS();" or "Radzen.Blazor.Rendering.RGB.Parse(Value).ToHex();" We made a project and used HTML 5 color picker instead but still used those functions and the issue still remained.
Author
Owner

@akorchev commented on GitHub (Dec 27, 2024):

Guys, we can't fix the problem unless we reproduce it. Please check the attached project and tell me what to do so the exception happens.

@akorchev commented on GitHub (Dec 27, 2024): Guys, we can't fix the problem unless we reproduce it. Please check the attached project and tell me what to do so the exception happens.
Author
Owner

@SOSHrspitz commented on GitHub (Dec 27, 2024):

The bug occurs on published versions only, so it is not repeatable on debugging. We found a solution to this issue by downgrading our visual studio from 17.12.x to 17.10.9 LTS, sorry for all the confusion

@SOSHrspitz commented on GitHub (Dec 27, 2024): The bug occurs on published versions only, so it is not repeatable on debugging. We found a solution to this issue by downgrading our visual studio from 17.12.x to 17.10.9 LTS, sorry for all the confusion
Author
Owner

@akorchev commented on GitHub (Dec 27, 2024):

I also tested with a published version dotnet publish -c Release and then ran the app via dotnet ColorPickerApp.dll

@akorchev commented on GitHub (Dec 27, 2024): I also tested with a published version `dotnet publish -c Release` and then ran the app via `dotnet ColorPickerApp.dll`
Author
Owner

@akorchev commented on GitHub (Mar 30, 2025):

I am closing this as we were unable to reproduce the problem no matter what we tested.

@akorchev commented on GitHub (Mar 30, 2025): I am closing this as we were unable to reproduce the problem no matter what we tested.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1399