-
Notifications
You must be signed in to change notification settings - Fork 379
Closed
Labels
area-Infrastructure-librariesArea maintained by .NET libraries team: APICompat, AsmDiff, GenAPI, GenFacades, PkgProj, etcArea maintained by .NET libraries team: APICompat, AsmDiff, GenAPI, GenFacades, PkgProj, etchelp wanted
Description
Take the following values:
Left:
[UnsupportedOS("browser")]
public class Foo
{
}
Right:
[UnsupportedOS("browser")]
[UnsupportedOS("ios")]
public class Foo
{
}
We would get an error:
error : CannotChangeAttribute : Attribute 'System.Runtime.Versioning.UnsupportedOSPlatformAttribute' on 'System.Net.Http.HttpClientHandler.Send(System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken)' changed from '[UnsupportedOSPlatformAttribute("browser")]' in the contract to '[UnsupportedOSPlatformAttribute("browser")]' in the implementation.
There should be no error here.
The problem seems to be as we group attributes by constructor documentation ID, and then when comparing the groups, we noticed the right group has 2 entries and the left 1, and thus it is marked as changed:
var attrGroups = attributes.GroupBy(c => c.Constructor.DocId()); |
And we always use the first attribute on the group for the error string:
arcade/src/Microsoft.DotNet.ApiCompat/src/Rules/Compat/AttributeDifference.cs
Lines 144 to 145 in 7f52af2
string contractKey = attributeComparer.GetKey(group[0].Attributes.First()); | |
string implementationKey = attributeComparer.GetKey(group[1].Attributes.First()); |
cc: @ericstj @steveisok
ericstj
Metadata
Metadata
Assignees
Labels
area-Infrastructure-librariesArea maintained by .NET libraries team: APICompat, AsmDiff, GenAPI, GenFacades, PkgProj, etcArea maintained by .NET libraries team: APICompat, AsmDiff, GenAPI, GenFacades, PkgProj, etchelp wanted