We are having a winforms add-on as a visualization in SpotFire. In the program we manullay set Tags using the below code
Tagcolumn = table.Columns["tags"].As<TagsColumn>());
Tagcolumn.Tag("tag", rowSelection);
After the above code is performed and when the UI refreshes to show the new tag,SpotFire is throwing below unhandled exception randomly (i.e) it does not always happens, I get 2 out of 5 times this exception.
"System.InvalidOperationException was unhandled Message: An unhandled exception of type 'System.InvalidOperationException' occurred in Spotfire.Dxp.Application.dll Additional information: Attempt to get snapshot info of a node state of type 'DisposedDocumentNodeState'.
Spotfire.Dxp.Application.Calculations.TableFilterSetCalculationDependency.CheckChange.AnonymousMethod__5()"
This error happens consistently If I have opened scatter plot with kmeans and line similarity applied on the plot.
Does anybody have idea why this happens and how to handle this error in the code.
Calling Set Tag functionality inside the ExecuteTransactions avoids the mentioned exception as below. Before SetTag was running in application UI thread which was causing the error, running SeTTag as part of document transactions as below has fixed the issue.
DataTable.Transactions.ExecuteTransactions(delegate
{
SetTag();
});