dotnet / dotnet/wpf

XamlLoadPermission(IEnumerable<XamlLoadAccess>) duplicates all items in the array

Open
#185 1 comment 4 reactions 1 assignee Claimed by @dipeshmsft View on GitHub
Bug
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

```cs

public static IEnumerable Ctor_XamlAccessLevels_TestData()
{
yield return new object[] { new XamlAccessLevel[0] };
yield return new object[] { new XamlAccessLevel[] { XamlAccessLevel.PrivateAccessTo(typeof(int)) } };
yield return new object[] { new XamlAccessLevel[] { XamlAccessLevel.PrivateAccessTo(typeof(int)), XamlAccessLevel.PrivateAccessTo(typeof(int)) } };
}

[Theory]
[MemberData(nameof(Ctor_XamlAccessLevels_TestData))]
public void Ctor_XamlAccessLevels(IEnumerable allowedAccess)
{
var permission = new XamlLoadPermission(allowedAccess);
Assert.False(permission.IsUnrestricted());
Assert.Equal(allowedAccess.Length, permission.AllowedAccess.Count);
}
```

Expected: the count of `permission.AllowedAccess` is equal to the count of the input array.
Actual: the count of `permission.AllowedAccess` is *double* the count of the input array

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.