Hello,
I would like to revive this old thread, because I am getting the exact error described above in very much the same situation.
On my backend, I have nested json data delivered as string that I need to insert as business objects.
I use the strategy originally described above to create nested business objects based on a JToken definition. Here is a snippet of how I prepare my report before compilation:
Code: Select all
public void LoadDataIntoReport(StiReport report, string jsonStringData, string businessObjectName)
{
var dataToken = Stimulsoft.Base.Json.Linq.JToken.FromObject(jsonStringData);
report.RegBusinessObject(businessObjectName, dataToken.ToList()); // Without the "toList()" call the generation behaves inconsistenly and warns of ambiguous businessobject columns
report.Dictionary.SynchronizeBusinessObjects(2); // This line throws an unhandled exception
}
The error I am currently getting is this (same as in previous posts on this thread):
Code: Select all
System.NullReferenceException: Object reference not set to an instance of an object.
at Stimulsoft.Report.Dictionary.StiBusinessObjectHelper.GetColumnsFromITypedList(ITypedList typedList)
at Stimulsoft.Report.Dictionary.StiBusinessObjectHelper.GetColumnsFromObject(Object value)
at Stimulsoft.Report.Dictionary.StiBusinessObjectHelper.GetColumnsFromData(Object data, Boolean includeChildDataSources)
at Stimulsoft.Report.Dictionary.StiBusinessObjectHelper.GetColumnsFromData(Object data)
at Stimulsoft.Report.Dictionary.StiDictionary.SynchronizeColumns(Object data, StiBusinessObject source)
at Stimulsoft.Report.Dictionary.StiDictionary.SynchronizeColumns(StiBusinessObjectData data, StiBusinessObject source)
at Stimulsoft.Report.Dictionary.StiDictionary.SynchronizeBusinessObjects()
at Stimulsoft.Report.Dictionary.StiDictionary.SynchronizeBusinessObjects(Int32 maxLevel)
On flat data (or data on the top level of the nested json) this code works fine, but without the call to synchronize business objects, nested data is of course not included.
Upon closer inspection (and a peek into the call stack via Visual Studio), I can see where in Stimulsoft the exception occured:

Is there a known way to get around this or an upcoming bugfix?
Thank you in advance for more information on the topic and have a nice day.