Serenity icon indicating copy to clipboard operation
Serenity copied to clipboard

Migration from 5.0.26 to 5.0.41 did not mention services.AddExcelExporter() must be added in Startup.cs

Open nel-sh5d0w opened this issue 2 years ago • 1 comments

In the Add Serenity.Extensions Package Reference of https://serenity.is/docs/migration/v5-0-26-to-v5-0-41 a call to services.AddExcelExporter() was missing, causing an error

InvalidOperationException: Unable to resolve service for type 'Serenity.Reporting.IDataReportExcelRenderer' while attempting to activate 'Serenity.Extensions.Pages.ReportController'.

In the documentation it only state that typeof(Serenity.Extensions.EnvironmentSettings).Assembly should be added

public void ConfigureServices(IServiceCollection services)
{
    services.AddSingleton<ITypeSource>(new DefaultTypeSource(new[] 
    {
        //...
        typeof(Serenity.Extensions.EnvironmentSettings).Assembly,
    }
}

When it should be

public void ConfigureServices(IServiceCollection services)
{
    services.AddSingleton<ITypeSource>(new DefaultTypeSource(new[] 
    {
        //...
        typeof(Serenity.Extensions.EnvironmentSettings).Assembly,
    }

   //...
   services.AddExcelExporter();
}

adding a call to services.AddExcelExporter() service extension

Took me a while to figure out what am I missing.

nel-sh5d0w avatar Nov 22 '21 00:11 nel-sh5d0w

Related file is in another repository :) PR's are accepted.

VictorTomaili avatar Nov 25 '21 08:11 VictorTomaili