Validation error responses ignore custom IProblemDetailsWriter
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
I'm trying to change the written format of all `ProblemDetails` objects for unrelated reasons, but unfortunately I can't seem to get validation errors to use my custom `IProblemDetailsWriter` instance, it's completely ignored.
My instance is called for the simple set of exception handling (that would generate a 500) or for authentication errors that I've tested with so far, so it's configured and available.
I've tried removing all other writer implementationss at various points in my code and then configuring my instance, but no luck.
### Expected Behavior
The provided custom `IProblemDetailsWriter` is used to write validation errors to the response.
### Steps To Reproduce
Clone [the provided repro](https://github.com/Clockwork-Muse/ProblemDetailsWriter)
Start up the application
Make a web request like `http://localhost:5285/some?id=750`, observe the results do not match the generic "some response" configured in the repro, and setting breakpoints in the relevant methods does not result in trapped execution either.
### Exceptions (if any)
None
### .NET Version
8.0.415
### Anything else?
```
.NET SDK:
Version: 8.0.415
Commit: 7bd5a8c970
Workload version: 8.0.400-manifests.c414f008
MSBuild version: 17.11.48+02bf66295
Runtime Environment:
OS Name: debian
OS Version: 12
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/8.0.415/
.NET workloads installed:
Configured to use loose manifests when installing new manifests.
There are no installed workloads to display.
Host:
Version: 8.0.21
Architecture: x64
Commit: 362ab6669d
.NET SDKs installed:
8.0.415 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.21 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.21 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
```
Also repros in net10
Contributor guide
Assessment
This issue has not been assessed yet.