How to resolve InvalidPropertyPathException?

Charts for WPF Forum

Posted 1 year ago by Nerd22 - Germany
Version: 22.1.4
Avatar

Hi there,

I'm getting an unhandled InvalidPropertyPathException when I'm adding a new line series to a XYChart. The detailed message says:

ActiproSoftware.Charts.Wpf.pdb not load

Could not resolve property path X. Please ensure that properties listed are valid.

So, this is my situation:

In WPF I'm using two independed XYCharts, one for each different graph to display. On each second a new graph is going to display on both sides. This is realized by the Invoke() function of Dispatcher class, because each graph is handled by an own thread. => Performance...

To make sure to have the correct graph, I'm resetting the Series property by using chart[Left/Right].Series.Clear(), followed by adding the new LineSeries object.

Each LineSeries object comes with the default required properties:

new LineSeries() {
    XPath = "X",
    YPath = "Y"
};

The property ItemsSource is going to set dynamically on each new second.

In the xaml file, my left chart doesn't have ItemsSource property, whereas my right chart does. This is intented, because I don't want to show the identical graph on both sides and the left chart also holds up to three different lines, whereas the right chart holds only one line.

chartLeft:

<charts:XYChart Margin="5,5,0,0" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" VerticalAlignment="Top" IsAxisBaselineVisible="True" GridLineMajorVisibility="Y" x:Name="chartLeft" LabelCollisionMode="Stacked" Grid.ColumnSpan="2">
	<!-- ... other basic settings here -->

	<!-- ... -->
	<charts:LineSeries XPath="X" YPath="Y" LineKind="Step"/>
</charts:XYChart>

chartRight:

<charts:XYChart Margin="0,5,5,0" Grid.Column="4" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Top" IsAxisBaselineVisible="True" GridLineMajorVisibility="Y" x:Name="chartRight">
	<!-- ... -->

	<!-- ... -->
	<charts:LineSeries ItemsSource="{Binding LineGraph}" XPath="X" YPath="Y" LineKind="Spline"/>
</charts:XYChart>

Well then,

the right chart is able to being updated successfully by:

internal void DisplayLiveGraphRight(List<float> currentGraph) {
	Dispatcher.Invoke(() => {
		ResetCharts(chartRight);

		foreach(float data in currentGraph) {
			/* Each single point is going to convert to a specific type. After that the given binding source LineGraph for my chartRight holds all data. */
		}

		chartRight.Refresh();
	});
}

However, for the left chart, it's a bit complicated, since it holds up to three different lines, the given exception appears after leaving Invoke():

internal void DisplayLiveGraphLeft(Area areaTohandle, IEnumerable<float> avgValues) {
	Dispatcher.Invoke(() => {
		ResetCharts(chartLeft);

		if (avgValues.Any()) {
			GraphCollectors[areaTohandle].ItemsSource = avgValues;
		}

		foreach(LineSeries ls in GraphCollectors.Values) {
			chartLeft.Series.Add(ls);

			//it doesn't matter, if a break here is set or not
			//break;
		}

		chartLeft.Refresh();
	});

/* after leaving Invoke() the exception appears... */
}

explanation:

GraphCollectors represents a Dictionary of type<Area, LineSeries>. Area represents an enumeration as a key, and LineSeries is the value. Every key holds a default LineSeries object of:

new LineSeries() {
    XPath = "X",
    YPath = "Y",
    LineKind = XYSeriesLineKind.Step
};

so, it doesn't matter, if the LineSeries of the given key has ItemsSource set or not, the exception appears either way. I already tested that.

Finally, I don't have an idea, why there an unhandled InvalidPropertyPathException appears. Since each LineSeries comes with XPath, YPath, ... and I haven't found in the base class(es) a similar property, which shall be set, I'm out. °(^.^)

Do you know, what's wrong here?

Comments (1)

Answer - Posted 1 year ago by Nerd22 - Germany
Avatar

Update: I already have solved the problem "by accident". I "just" forgot to convert the avgValues to the specified format for my graph. Thats why this message "Could not resolve property path X. Please ensure that properties listed are valid." appeared.

That sounds really funny, when you realize, that the problem is solved by a small change, whereas you spent a lot of hours to solve that...

The latest build of this product (v24.1.2) was released 2 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.