Page 1 of 1

'read-only state' error

Posted: Mon Jun 24, 2019 9:35 am
by ali_jorgensen

I'm having a problem with an 'InvalidOperationException' with the message 'Cannot set a property on object '' because it is in a read-only state.' on a WPF window.

It's difficult to figure out exactly what's causing it, in my own code it's simply a property notifying of a change that looks from the stack trace to be updating bindings, ultimately reaching the 'LightningChartUltimate.TitleChanged' handler, and within the 'ChartTitle.CreateShadow' method, it sets the current value of a property which throws the exception. The title of the text IS bound to a property on the DataContext, but the shadow is not, it's just transparent. The property in my code that's being updated IS the one the DataContext is bound to- basically it's a 'ChartViewModel' that implements INotifyPropertyChanged and has a property called 'Title', that the chart title is bound to. It's on replacing the 'ChartViewModel' instance that I hit this error.

I'm using the SemibindableCharting library.

At the point where it does this, it's replacing an existing DataContext, when it first sets an initial one, it works just fine.

Any idea what circumstances might cause this error?



Re: 'read-only state' error

Posted: Thu Jun 27, 2019 7:32 am
by Arction_LasseP

We tested this issue but coudn't reproduce the error message you described. However, the message most likely indicates that you are trying to update a frozen object (read-only state).
Here are some threads about the same error message, which could be informative: ... only-state ... ?forum=wpf

Without seeing the code it is hard to say where exactly is the cause of this error. If you are unable to find the cause of the exception with the help of the above articles,
you can always mail us (support(at) the parts of your code regarding the Title -property, or alternatively post them here, so we can track down the exact part causing this error.