LoadPrepared throws ArgumentOutOfRangeException

i have a very simple report created using FastReport .NET v 2024.2.0 community edition.

When i try to generate the below code it throws error at report.LoadPrepared method.

Exception details

System.AggregateException: 'One or more errors occurred. (startIndex cannot be larger than length of string. (Parameter 'startIndex'))'

ArgumentOutOfRangeException: startIndex cannot be larger than length of string. (Parameter 'startIndex')

Here is the code.

 string epcdJsonString = File.ReadAllText(".\\ReportTemplate\\SampleJson.json");

 RegisteredObjects.AddConnection(typeof(JsonDataConnection));

 JsonDataSourceConnection jsonDataSourceConnection = new JsonDataSourceConnection();

 jsonDataSourceConnection.ConnectionString = epcdJsonString;

 jsonDataSourceConnection.CreateAllTables();

 Report report = new Report();

 report.LoadPrepared(".\\ReportTemplate\\TestReport.frx");

 report.Dictionary.Connections.Add(jsonDataSourceConnection);

 report.RegisterData(jsonDataSourceConnection.DataSet);

 report.Prepare();


What am i missing here.. the json structure is same as what i have used in the designer.

Note : I am able to preview the report properly in the designer.

Plus Validate Report does not show any error.

Leave a Comment