lundi 22 mai 2017

PropertyChanged | CallerMemberName | AmbiguousMatchExcpetion

I get the following error on runtime: AmbiguousMatchExcpetion "Ambiguous Match found."

Does someone knows what is the reason for?

Class

public class MyTrimmedClass : Control, INotifyPropertyChanged
{
    public HtUserGroupSetup CurrentUserGroupSetup
    {
        get { return _CurrentUserGroupSetup; }
        set
        {
            if (_CurrentUserGroupSetup != value)
            {
                _CurrentUserGroupSetup = value;
                OnPropertyChanged();
            }
        }
    }
    private HtUserGroupSetup _CurrentUserGroupSetup;


    public event PropertyChangedEventHandler PropertyChanged;

    [NotifyPropertyChangedInvocator]
    protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }
}


public class HtUserGroupSetup : HtUserGroup
{
    public new List<HtPermissionSetup> Permissions
    {
        get { return _Permissions; }
        set
        {
            if (_Permissions != value)
            {
                _Permissions = value;
                OnPropertyChanged("Permissions");
            }
        }
    }
    private List<HtPermissionSetup> _Permissions = new List<HtPermissionSetup>();

    public HtUserGroupSetup(HtUserGroup userGroup)
    {
        Name = userGroup.Name;
        Description = userGroup.Description;
    }
}

public class HtUserGroup : HtBaseServiceData
{
    private string _Name = "";
    [DataMember]
    public string Name
    {
        get { return _Name; }
        set
        {
            if (_Name != value)
            {
                _Name = value;
                OnPropertyChanged("Name");
            }
        }
    }

    private string _Description = "";
    [DataMember]
    public string Description
    {
        get { return _Description; }
        set
        {
            if (_Description != value)
            {
                _Description = value;
                OnPropertyChanged("Description");
            }
        }
    }

    private List<HtPermission> _Permissions = new List<HtPermission>();
    [DataMember]
    public List<HtPermission> Permissions
    {
        get { return _Permissions; }
        set
        {
            if (_Permissions != value)
            {
                _Permissions = value;
                OnPropertyChanged("Permissions");
            }
        }
    }
}

public abstract class HtBaseServiceData : INotifyPropertyChanged
{
    protected void OnPropertyChanged(string property)
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
    }
    public event PropertyChangedEventHandler PropertyChanged;
}

Screenshot

Screenshot

StackTrace

System.Reflection.AmbiguousMatchException ist aufgetreten.

HResult=-2147475171 Message=Mehrdeutige Übereinstimmung gefunden.
Source=mscorlib StackTrace: bei System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) InnerException:

StackTrace





Aucun commentaire:

Enregistrer un commentaire