Won't Fix
Last Updated: 02 Apr 2018 08:11 by ADMIN
ADMIN
Peter Milchev
Created on: 04 Jul 2017 14:15
Category: Calendar
Type: Bug Report
0
Not supported exception when the UICulture is a neutral one in .NET 3.5
When the culture is set using Thread.CurrentThread.CurrentUICulture = new CultureInfo("it");
The following exception is thrown
https://www.screencast.com/t/YnQstdBUrY

1 comment
ADMIN
Angel Petrov
Posted on: 02 Apr 2018 08:11
The problem comes from the fact that the calendar internally uses DateTimeFormatInfo based on the culture. Only in .NET 3.5 this setup throws an exception. Moreover in the MS documentation https://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.datetimeformat(v=vs.90).aspx it is stated that - "A DateTimeFormatInfo can be created only for the invariant culture or for specific cultures, not for neutral cultures. For more information, see the description of the CultureInfo class."
Since we internally use the DateTimeFormatInfo on multiple places and altering the logic will break the functionality the issue is marked as won't fix.

The workarounds are.
1. Set invariant culture.
2. Use a specific culture.
3. Upgrade to .NET 4.0 or 4.5
4. Use a controller adapter with the following code.

public class CalendarFix : ControlAdapter
{
    protected override void Render(HtmlTextWriter writer)
    {
        var calendar = this.Control as RadCalendar;
        if (calendar != null)
        {
            try
            {
                base.Render(writer);
                return;
            }
            catch (Exception)
            {
                calendar.Culture = CultureInfo.InvariantCulture;
            }
        }
        base.Render(writer);
    }
}