Unit test projects with JsonSerializerIsReflectionEnabledByDefault=false cannot use WebApplicationFactory #55586
Labels
area-networking
Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Is there an existing issue for this?
Describe the bug
If an xunit Test Project includes the following in the csproj file:
then unit tests which use a WebApplicationFactory will fail with an InvalidOperationException with a stack similar to this:
I believe the root cause is this line in the WebApplicationFactory.GetContentRootFromFile:
Expected Behavior
WebApplicationFactory should work.
Steps To Reproduce
A complete repo is available at https://github.com/dougclutter/WebApplicationFactoryJsonSerialization
Exceptions (if any)
InvalidOperationException
.NET Version
8.0.204
Anything else?
No response
The text was updated successfully, but these errors were encountered: