Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request updates lamar to .net 9 and all of its dependencies, this should fix #405.
As already mentioned via discord, there seems to be a timing problem in asp.net core 9 in combination with lamar.
These tests in MinimalApiTests.integration_tests are red, it can be fixed when adding this two lines of code, after the call of .UseLamar(....) and builder.Build() and before the call of app.Run();
Note
This workaround also works in real world asp.net core 9 applications.
The error when running the tests or starting a real world asp.net core 9 application
Unable to resolve service for type 'System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Diagnostics.IDeveloperPageExceptionFilter]' while attempting to activate 'Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl'.
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
I also added a break point in Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl and the IEnumerable<Microsoft.AspNetCore.Diagnostics.IDeveloperPageExceptionFilter> is always empty, so it's seems there is some kind of timing issue when using Lamar (therefore it's not a problem with a missing registration).
Input from @jeremydmiller
Somehow the IEnumerable<Microsoft.AspNetCore.Diagnostics.IDeveloperPageExceptionFilter> is not even tried to be resolved by lamar (except when calling container.GetServices<Microsoft.AspNetCore.Diagnostics.IDeveloperPageExceptionFilter>(); before (maybe cached by aspnet.core)?)
Edit
Other dependencies are resolved by lamar
But of course that isn't a real solution, any help would highly be appreciated.