fullstackhero / dotnet-starter-kit

Production Grade Cloud-Ready .NET 8 Starter Kit (Web API + Blazor Client) with Multitenancy Support, and Clean/Modular Architecture that saves roughly 200+ Development Hours! All Batteries Included.
https://fullstackhero.net/dotnet-webapi-boilerplate/
MIT License
5.19k stars 1.56k forks source link

[BUG] ICurrentUser to Singleton #195

Closed RHaughton closed 2 years ago

RHaughton commented 2 years ago

Describe the bug When I Launch project I get an error.

To Reproduce Launch the project

Error: System.InvalidOperationException: Error while validating the service descriptor 'ServiceType: Infrastructure.Middlewares.ExceptionMiddleware Lifetime: Singleton ImplementationType: Infrastructure.Middlewares.ExceptionMiddleware': Cannot consume scoped service Application.Abstractions.Services.Identity.ICurrentUser' from singleton Infrastructure.Middlewares.ExceptionMiddleware'.

I Believe the ICurrentUser should be registered in Singleton (ISingletonService).

iammukeshm commented 2 years ago

Latest code?

iammukeshm commented 2 years ago

public interface ICurrentUser : IScopedService

ICurrentUser is already in Scoped Lifetime. Are you sure that you are using the latest code? There have been few new commits recently around this.

frankyjquintero commented 2 years ago

update your source code, the Exception Middleware registry was changed

https://github.com/fullstackhero/dotnet-webapi-boilerplate/blob/6b29abee2c277530dd1d7789094b345c31b011aa/src/Infrastructure/Extensions/MiddlewareExtensions.cs#L28

RHaughton commented 2 years ago

Thanks, I somehow missed this commit. I'm already using this and manually checking all commits and applying them. is there a better way to check if all my files are up to date?

iammukeshm commented 2 years ago

@RHaughton , are you using the Nuget Package?