I have a custom screen with a custom Graph, and my graph has a View delegate that calls another method in the same graph. Doesn't seem that crazy, but an exception is thrown by Acumatica:
Unable to cast object of type '<GetVersions>d__25' to type 'System.Collections.IDictionary'.
My delegate method is simply this:
protected virtual IEnumerable reportVersions()
{
yield return GetVersions();
}
public virtual IEnumerable GetVersions()
{
yield return null;
}
Yet, when I take out the call:
protected virtual IEnumerable reportVersions()
{
yield return null;
}
there is no error. The call stack is long, but seems to be happening when the grid referencing the view is being rendered on the page and binding to this as a data source. Here's the top of the call stack:
[InvalidCastException: Unable to cast object of type '<GetVersions>d__25' to type 'System.Collections.IDictionary'.]
PX.Data.PXCache`1.GetValueInt(Object data, String fieldName, Boolean forceState, Boolean externalCall) +807
PX.Data.PXCache`1.GetValueExt(Object data, String fieldName) +123
PX.Data.PXGraph.GetValueExt(String viewName, Object data, String fieldName) +126
PX.Web.UI.PXBaseDataSource.GetValueExt(String viewName, Object data, String fieldName) +151
PX.Web.UI.PXDataSourceView.GetValue(Object data, String fieldName) +42
PX.Web.UI.PXFormDataProvider.GetFieldValue(String field, DataSourceView view)
...
It appears to be trying to retrieve a field value. Any thoughts?
Change the reportVersions()
method by this
protected virtual IEnumerable reportVersions()
{
return GetVersions();
}
or
protected virtual IEnumerable reportVersions()
{
foreach (var item in GetVersions())
{
yield return item;
}
}