A gotcha in ASP.NET Core Minimal APIs causes an InvalidOperationException when a service class injected into an endpoint has a non-static TryParse method. Starting from .NET 6, the framework validates the signature of any TryParse method found on parameter types and throws if it doesn't match the expected static binding convention. The fix is simple: rename the method to something other than TryParse so the model binding conventions don't apply.

3m read timeFrom bartwullems.blogspot.com
Post cover image
Table of contents
The codeThe problemThe solutionMore information

Sort: