[Solved] Reporting engine wont use my implementation of ISharedDataSourceResolver

0 Answers 7 Views
DataSources
R
Top achievements
Rank 1
R asked on 05 Mar 2026, 12:28 PM

Hello,

I want to generate a pdf file on the backend from a report that uses a SharedDataSource..
The report gets loaded with an instance of  my implementation of the IReportSourceResolver.
The report uses a SharedDataSource. And I have also an implemenation of the ISharedDataSourceResolver configured.

I use the reporting engine in the following way:

ReportSource reportSource = _resolver.Resolve(reportName, OperationOrigin.GenerateReportDocument, resolvedParams);
var processor = new ReportProcessor();
var deviceInfo = new System.Collections.Hashtable();
RenderingResult result = processor.RenderReport("PDF", reportSource, deviceInfo);
After saving the result to File I get the pdf, but is shows a big red error box with the following message:
An error has occurred while processing Table 'table1': Cannot instantiate the referenced DataSource. Could not find file 'C:PATH TO A SHARED DATA SOURCE FILE'

This error lets my think that the reporting engine is not using its configured instance of the ISharedDataSourceResolver. The breakpoints dont get hit also, but when viewing the report in the webDesigner, the shared datasources get loaded correctly using the ISharedDataSourceResolver

I have the following configuration in the appsettings.json:

"telerikReporting": {
    "processing": {
      "sharedDataSourceResolver": {
        "provider": "custom",        
        "parameters": [
          {
            "name": "typeName",
            "value": "NameSpaceAndClassName, containing AssemblyName"
          }
        ]
      }
    } 
  }

In program.cs I have the following:
As I understand this is for the reporting engine:
builder.Services.AddScoped<IReportServiceConfiguration>(sp =>
{
    return new ReportServiceConfiguration
    {
        // ReportingEngineConfiguration = sp.GetService<IConfiguration>(), //(?? is this needed? does not load config either
       Storage = new FileStorage(),
       ReportSourceResolver = sp.GetRequiredService<DatabaseReportSourceResolver>()
    };
});

And as I understand this is for the webDesigner: 
builder.Services.AddScoped<ISharedDataSourceStorage, DatabaseSharedDataSourceStorage>();
builder.Services.AddScoped<IReportDesignerServiceConfiguration>(sp => new ReportDesignerServiceConfiguration
{
    DefinitionStorage = new DatabaseDefinitionStorage(sp.GetRequiredService<IReportDefinitionDataStore>()),  
    SharedDataSourceStorage = sp.GetRequiredService<ISharedDataSourceStorage>(),
    SettingsStorage = new FileSettingsStorage(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Telerik Reporting")),
});

What am I missing? what is the correct way to configure the reporting engine to use my ISharedDataSourceResolver implementation?
The webReportDesigner does work correctly when using reports with sharedDataSources, It only happens when I instantiate the reporting engine manualy in the backend.

Kind regards


No answers yet. Maybe you can help?

Tags
DataSources
Asked by
R
Top achievements
Rank 1
Share this question
or