❔ Dependency injection fails-Value cannot be null

Kinda straightforward , here is the code:
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddSingleton<LessonParametersService>();

Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<lingumindApplicationModule>();
});
getResults(context);


}

private void getResults(ServiceConfigurationContext context)
{
var lessonParametersService = context.Services.GetRequiredService<LessonParametersService>();
var result = lessonParametersService.getResult().GetAwaiter().GetResult();
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddSingleton<LessonParametersService>();

Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<lingumindApplicationModule>();
});
getResults(context);


}

private void getResults(ServiceConfigurationContext context)
{
var lessonParametersService = context.Services.GetRequiredService<LessonParametersService>();
var result = lessonParametersService.getResult().GetAwaiter().GetResult();
}
Any ideas?
1 Reply
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server