dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.91k stars 4.63k forks source link

Unable to add trimming tests for OOB assemblies #102837

Open steveharter opened 3 months ago

steveharter commented 3 months ago

When trimming tests are added to an OOB assembly, such as System.Data.OleDb, the build\test command results in error messages like this due to the source assembly not being found. This is due to missing target architecture in the path:

C:\git\ComponentModel\.dotnet\sdk\9.0.100-preview.3.24204.13\Microsoft.Common.CurrentVersion.targets(4983,5): error MSB3030: Could not copy the file "C:\git\ComponentModel\artifacts\bin\System.Data.Odbc\Release\net9.0\System.Data.
Odbc.dll" because it was not found. [C:\git\ComponentModel\artifacts\bin\trimmingTests\projects\System.Data.Odbc.TrimmingTests\OdbcParameterTest\win-x64\project.csproj]

In this case, there is no net9.0 subfolder, but there is net9.0-windows, net9.0-unix, etc.

FWIW adding trimming tests include:

Linking https://github.com/dotnet/runtime/issues/102244 for the need to add OOB trimming tests.

dotnet-policy-service[bot] commented 3 months ago

Tagging subscribers to this area: @dotnet/runtime-infrastructure See info in area-owners.md if you want to be subscribed.

dotnet-policy-service[bot] commented 3 months ago

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries See info in area-owners.md if you want to be subscribed.

ericstj commented 3 months ago

I wonder if this is due to how the test is referencing the src library? @steveharter could you share the change you tried that didn't work here?

FWIW, I see the product test uses the following frameworks. https://github.com/dotnet/runtime/blob/a4407a106f883a6593105a660d44da6f8fa4017c/src/libraries/System.Data.OleDb/tests/System.Data.OleDb.Tests.csproj#L3

I could imagine if the trimming test wasn't using the same it might hit a case where the assembly it needed wasn't built in a vertical build - since the vertical build will only build a subset of the frameworks.