APICompat: False CP0001 Errors Raised for Added TFMs Not Present in Baseline
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Description
We have started using APICompat during ADO pipeline runs. When comparing System.ValueTuple version 4.6.1 against 4.5.0 using APICompat, false-positive CP0001 errors are raised for types existing in lib/net462 but absent from lib/net47, despite net462 not being present in the 4.5.0 baseline. The tool appears to evaluate frameworks that were added in the newer package and not available in the baseline, leading to misleading break reports.
### Reproduction Steps
- Run APICompat with the following command:
`apiCompat package --baseline-package "C:\Users\ykumashev\.nuget\packages\system.valuetuple\4.5.0\system.valuetuple.4.5.0.nupkg" "C:\Users\ykumashev\.nuget\packages\system.valuetuple\4.6.1\system.valuetuple.4.6.1.nupkg"`
- Observe reported errors related to types in lib/net462.
### Expected behavior
APICompat should not compare target frameworks that do not exist in both baseline and target packages. Compatibility analysis should be scoped to shared TFMs only.
### Actual behavior
False positives reported:
CP0001: Type 'System.ValueTuple' exists on lib/net462/System.ValueTuple.dll but not on lib/net47/System.ValueTuple.dll
...
These errors are misleading, as net462 is not present in the baseline package.
### Regression?
No
### Known Workarounds
None
### Configuration
- APICompat CLI run on Windows 11
- Baseline package: System.ValueTuple.4.5.0.nupkg
- Target package: System.ValueTuple.4.6.1.nupkg
### Other information
- Attempted to use --baseline-package-frameworks-to-ignore to exclude irrelevant frameworks (our services support only three: net462, net8, net9), but the issue persisted. APICompat continued to compare frameworks that are not mutually present in both packages.
- It would be helpful to have more granular options for controlling TFM comparison, such as:
--baseline-package-frameworks-to-check: explicitly specify which TFMs should be included in baseline analysis.
--target-package-frameworks-to-ignore: exclude specific TFMs from the target package during compatibility comparison.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.