Skip to content

Regression 2.0.0-rc5.4 -> (2.0.0-rc6 | 2.0.0-rc6.1) - HexToPaintTypeConverter throws #2114

@Kuurama

Description

@Kuurama

Describe the bug

The [System.ComponentModel.TypeConverter(typeof(HexToPaintTypeConverter))] seem to be problematic (or have underlying issues).

Updating from LiveChartsCore.SkiaSharpView.Avalonia 2.0.0-rc5.4 to 2.0.0-rc6 | 2.0.0-rc6.1 causes the following error on my end:

System.NotSupportedException: HexToPaintTypeConverter cannot convert from Avalonia.Markup.Xaml.MarkupExtensions.DynamicResourceExtension.
   at System.ComponentModel.TypeConverter.GetConvertFromException(Object value)
   at System.ComponentModel.TypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at LiveChartsCore.SkiaSharpView.TypeConverters.HexToPaintTypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)

To Reproduce
Set the following LegendTextPaint:

// xmlns:avalonia="clr-namespace:LiveChartsCore.SkiaSharpView.Avalonia;assembly=LiveChartsCore.SkiaSharpView.Avalonia"
<avalonia:PieChart Name="Pie" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
                                       Series="{Binding PieChartSeries}" LegendPosition="Bottom"
                                       LegendTextPaint="{DynamicResource TextPaint}" AutoUpdateEnabled="False" />

With the follownig ResourceDictionary:

// xmlns:painting="clr-namespace:LiveChartsCore.SkiaSharpView.Painting;assembly=LiveChartsCore.SkiaSharpView"
<ResourceDictionary.ThemeDictionaries>
        <ResourceDictionary x:Key='Light'>
            <SolidColorBrush x:Key='TextColor'>#21262F</SolidColorBrush>
            <skiaSharp:SKColor x:Key="TextSKColor">#21262F</skiaSharp:SKColor>
            <painting:SolidColorPaint x:Key="TextPaint" Color="{StaticResource TextSKColor}" />
        </ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

The avalonia version in use is the 11.3.12, since it works using one of the older LiveChartsCore.SkiaSharpView.Avalonia rc, it's a regression.

Expected behavior
Expected to work like it did on 2.0.0-rc5.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions