Skip to content

Invisible XamlLineSeries causes crash when IsVisibleAtLegend=True (which is the default value) #2054

@fove-wangfys

Description

@fove-wangfys

Describe the bug
Having an XamlLineSeries that is inivisble at startup causes crash.

To Reproduce

  1. Create a MAUI app from template
  2. Add a very simple CartesianChart like this:
<lvc:CartesianChart HeightRequest="500" LegendPosition="Top">
	<lvc:CartesianChart.Series>
		<lvc:SeriesCollection>
			<lvc:XamlLineSeries IsVisible="False"/>
		</lvc:SeriesCollection>
	</lvc:CartesianChart.Series>
</lvc:CartesianChart>
  1. Build and run. The app window appears but apparently the UI is not constructed from Xaml. After a few seconds the app crashes.

Screenshots
Image

Image

Additional context

  1. If LegendPosition="Top" is removed, everything is fine.
  2. If IsVisibleAtLegend="True" is added, everything is fine.
  3. If using IsVisible="{Binding Visible}" to bind, and Visible has an initial value of false, crash will happen
  4. If using IsVisible="{Binding Visible}" to bind, and Visible has an initial value of true, updating it to false will not cause crash. (And the line series is hidden successfully)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions