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:
|
string contractKey = attributeComparer.GetKey(group[0].Attributes.First()); |
|
string implementationKey = attributeComparer.GetKey(group[1].Attributes.First()); |
cc: @ericstj @steveisok
Take the following values:
Left:
Right:
We would get an error:
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:
arcade/src/Microsoft.Cci.Extensions/Mappings/AttributesMapping.cs
Line 43 in 7f52af2
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
cc: @ericstj @steveisok