Finbuckle / Finbuckle.MultiTenant

Finbuckle.MultiTenant is an open-source multitenancy middleware library for .NET. It enables tenant resolution, per-tenant app behavior, and per-tenant data isolation.
https://www.finbuckle.com/multitenant
Apache License 2.0
1.26k stars 256 forks source link

Improve error message for `Unable to resolve service for type <TenantInfo> while attempting to activate...` #837

Open fdcastel opened 1 month ago

fdcastel commented 1 month ago

I'm having this problem now and it is surely a configuration problem. But the generic message isn't helpful pointing to where the problem is.

It seems several other issues (#799, #465, #340, #140) had the same problem.

More informative messages like

This way, if we see the generic Unable to resolve service for type ... message again we could probable use this as a good indicator for "You forgot to call .Add/UseMultitenant()."

Also: #628 (related).

AndrewTriesToCode commented 4 weeks ago

I like this idea. One reason I removed DI for TenantInfo was to eliminate one major cause of these exceptions and these errors messages would go further.