You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ApiCompat does not notice if the right assembly breaks compatibility by having more constraints on a type parameter than the left assembly. See dotnet/runtime#99878.
namespaceConstraintApiCompat{publicsealedclassClass1<TEnum>
#if!NETSTANDARDwhereTEnum:struct, System.Enum
#endif
{// This is here just to show that ApiCompat works in other respects.
#if NETSTANDARD
publicvoidExtra(){}
#endif
}}
ApiCompat should report at least one API compatibility error about the type constraint:
API compatibility errors between 'bin/Debug/netstandard2.0/ConstraintApiCompat.dll' (left) and 'bin/Debug/net8.0/ConstraintApiCompat.dll' (right):
CPxxxx: Type 'ConstraintApiCompat.Class1<TEnum>' does not have constraints 'where TEnum : struct, System.Enum' on bin/Debug/netstandard2.0/ConstraintApiCompat.dll but has on bin/Debug/net8.0/ConstraintApiCompat.dll
CP0002: Member 'void ConstraintApiCompat.Class1<TEnum>.Extra()' exists on bin/Debug/netstandard2.0/ConstraintApiCompat.dll but not on bin/Debug/net8.0/ConstraintApiCompat.dll
API breaking changes found. If those are intentional, the APICompat suppression file can be updated by specifying the '--generate-suppression-file' parameter.
Actual result
ApiCompat does not report any API compatibility errors about the type constraint:
API compatibility errors between 'bin/Debug/netstandard2.0/ConstraintApiCompat.dll' (left) and 'bin/Debug/net8.0/ConstraintApiCompat.dll' (right):
CP0002: Member 'void ConstraintApiCompat.Class1<TEnum>.Extra()' exists on bin/Debug/netstandard2.0/ConstraintApiCompat.dll but not on bin/Debug/net8.0/ConstraintApiCompat.dll
API breaking changes found. If those are intentional, the APICompat suppression file can be updated by specifying the '--generate-suppression-file' parameter.
Now that this has been fixed, I'm curious about whether the fix reveals any other mismatches in reference assemblies, similar to dotnet/runtime#99878. If there are any, will they show up in GitHub Checks for some "Update dependencies" pull request at dotnet/runtime?
Describe the bug
ApiCompat does not notice if the right assembly breaks compatibility by having more constraints on a type parameter than the left assembly. See dotnet/runtime#99878.
To Reproduce
ConstraintApiCompat.csproj
Class1.cs
.config/dotnet-tools.json
Build
Expected result
ApiCompat should report at least one API compatibility error about the type constraint:
Actual result
ApiCompat does not report any API compatibility errors about the type constraint:
Exceptions (if any)
None.
Further technical details
No IDE.
The text was updated successfully, but these errors were encountered: