Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ public sealed class XamlLoadPermission : CodeAccessPermission, IUnrestrictedPerm
public XamlLoadPermission(PermissionState state) { }
public XamlLoadPermission(XamlAccessLevel allowedAccess) { }
public XamlLoadPermission(IEnumerable<XamlAccessLevel> allowedAccess) { }
[ComVisible(false)]
public override bool Equals(object obj) { return false; }
Copy link

@weltkante weltkante Jun 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a valid implementation because x.Equals(x) returns false, which will cause all sorts of bugs if anyone calls this method. You should use ReferenceEquals(this, obj) or throw an exception if you don't want to support equality.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This impl. will get deleted from dotnet/wpf shortly, and we'll consume the one from dotnet/corefx#38405. Let's make sure we get the corefx PR right.

[ComVisible(false)]
public override int GetHashCode() { return base.GetHashCode(); }
public IList<XamlAccessLevel> AllowedAccess {get; private set;} = new ReadOnlyCollection<XamlAccessLevel>(Array.Empty<XamlAccessLevel>());
public override IPermission Copy() { return new XamlLoadPermission(PermissionState.Unrestricted); }
public override void FromXml(SecurityElement elem) { }
Expand Down