AvaloniaCommunity / Avalonia.Microcharts

simple Avalonia only port of the Microcharts charting library
MIT License
162 stars 14 forks source link

Exceptions caused by auto-sizing #2

Open Developer-Simon opened 3 years ago

Developer-Simon commented 3 years ago

I added the example code to my own project, build in avalonia v0.10.3. At the point, the MicrochartControl is initialized with its "Chart" property, i get an exception from the code line:

 "protected override Size MeasureOverride(Size availableSize)
            => availableSize;

thrown by the native BuildAvaloniaApp() method in the Program.cs file. Could this be a version incompatiblity or did i miss something in my code?

image

Developer-Simon commented 3 years ago

I got a little bit deeper into it and found out, that this issue is caused by an inner failure in autosizing the charts. If I set the height and width of the charts in the .xaml file the exception doesn't trigger. But there's also an issue in the MicrochartControl class, where the .Equals() method got into an recursion infinity loop, calling itself. For implementation in my project, i temporarily disabled the method by setting it constantly true. image