You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I've been using Fastendpoints for some personal project, and I love it! But I think I found a bug with .UseFastendpoints and DI. Here's the current setup
API 1: API.Admin
-- This API has services A, B and C registered. The API works as expected and does the work perfectly.
API 2: API
-- This API has services D and E registered. The API works as expected and does the job perfectly.
Integration Test project
-- Two fixtures: public class PublicFixture : AppFixture<API.Startup> and public class AdminFixture : AppFixture<API.Admin.Startup>
The Configure method on API 1 looks like this:
builder.UseFastEndpoints(c =>
{
c.Endpoints.Filter = ep => ep.EndpointType.Namespace.StartsWith("API.Admin");
});
The Configure method on API 2 looks like this:
builder.UseFastEndpoints(c =>
{
c.Endpoints.Filter = ep => !ep.EndpointType.Namespace.StartsWith("API.Admin");
});
In short, each Configure has that filter that should only register the endpoints for that particular assembly. However, even when we get the expected true/false from the ep.EndpointType.Namespace.StartsWith("API.Admin"); call, I get a DI error that Service A is not registed in API 2. It will never be registered because API 2 does not use or need Service A
I believe having the filter should not register the dependencies in DI.
I can build a small ZIP sample with the example, if needed.
Thanks!
The text was updated successfully, but these errors were encountered:
are you spinning up 2 different web apps (WebApplications) inside the same .net application domain?
if that's the case, there might be some potential for trouble with integration testing as you're experiencing, as FE was not designed to be used that way. however, you might be able to work around that by doing keyed service registrations.
may i know why you're putting everything in a single assembly and booting up multiple web applications in the same process? ideally, you'd be building a separate binary/assembly per each API and using something like aspire/docker compose/rider or vs "multi project running" for standing up each app in their own isolated app domains/memory space.
if i've misunderstood your use case, please attach a debuggable repro project so i can get a better understanding of what's happenning.
Hello! I've been using Fastendpoints for some personal project, and I love it! But I think I found a bug with .UseFastendpoints and DI. Here's the current setup
API 1: API.Admin
-- This API has services A, B and C registered. The API works as expected and does the work perfectly.
API 2: API
-- This API has services D and E registered. The API works as expected and does the job perfectly.
Integration Test project
-- Two fixtures:
public class PublicFixture : AppFixture<API.Startup>
andpublic class AdminFixture : AppFixture<API.Admin.Startup>
The
Configure
method on API 1 looks like this:The
Configure
method on API 2 looks like this:In short, each Configure has that filter that should only register the endpoints for that particular assembly. However, even when we get the expected true/false from the
ep.EndpointType.Namespace.StartsWith("API.Admin");
call, I get a DI error that Service A is not registed in API 2. It will never be registered because API 2 does not use or need Service AI believe having the filter should not register the dependencies in DI.
I can build a small ZIP sample with the example, if needed.
Thanks!
The text was updated successfully, but these errors were encountered: