Integration Test issue on ubuntu-latest (.NET 8)
Hi,
While running the basic example for integration tests with WebApplicationFactory in a .net8 (8.0.303) web api on ubuntu pipeline (https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-8.0
I'm getting this exception :
I've found this issue : https://github.com/dotnet/runtime/issues/101581
Any hints / more information ?
Integration tests in ASP.NET Core
Learn how integration tests ensure that an app's components function correctly at the infrastructure level, including the database, file system, and network.
GitHub
System.IO.FileLoadException: Undefined resource string ID:0x8013162...
Description Observe that client.GetAsync errors out with the following error message: System.IO.FileLoadException: Undefined resource string ID:0x80131621. This issue only occurs when both conditio...
6 Replies
FullStackTrace (1) :
FullstackTrace (2) :
FullstackTrace (2) :
it seems like that ticket includes a workaround; have you tried it?
Ah brilliant ! Solved.
I had
But i've made a mistake on how i've declared InternalsVisibleTo.
Project structure :
- WebApi8
- src
- WebApi8.csproj
- Program.cs
- test
- IntegrationTest
- IntegrationTest.csproj
- Test.cs
Issue :
Fix :
nice, glad you got it sorted 🙂
personally i've always had issues with InternalsVisibleTo... these days i tend to just test the public interfaces
especially for integration tests i think that's more 'honest' almost than using secret APIs nobody else can access
wait there's a dedicated
InternalsVisibleTo
MSBuild thing now?Yeah i had some issue with InternalsVisibleTo in the past as well, i never know if you need the relative path or the project name (but seems that assembly name is the correct answer !).
https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#internalsvisibleto
I also tend to want to find the information that works without reading the full doc which is my main issue 🙂
Thanks again !
MSBuild properties for Microsoft.NET.Sdk - .NET
Reference for the MSBuild properties and items that are understood by the .NET SDK.