question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inheritance and DependsOn() Not working...

See original GitHub issue

Hi,

i have an issue about Inheritance. Imagine this :

[ImplementPropertyChanged]
    public class a1
    {
        public string a { get; set; }

        [DependsOn("a")]
        public string b => this.a + " LAURE ";
    }

It’s working well. But now imagine this :

`    [ImplementPropertyChanged]
    public class a1
    {
        public string a { get; set; }

    }

    // Change nothing : [ImplementPropertyChanged]
    public class a2 : a1
    {
        [DependsOn("a")]
        public string b => this.a + " LAURE ";
    }

The second case is not working (my binding is never notified). “a” is not found by Fody.PropertyChanged compilator (a warning say it) so it ignor it… Any solution ? Or any way to call it manually ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
SimonCroppcommented, Oct 16, 2016

sorry but the parent class should not know about child property notifications.

1reaction
bkettouchecommented, Oct 13, 2016

Another simple example of what i mean

public class a1 : classImplementINotify
{
    public string a { get; set; }
}

public class a2 : a1
{
    [AlsoNotifyFor("a")]
    public string c { get; set; } // WORKS
    [DependsOn("a")]
    public string d { get; set; } // Not working but should right ? a2 know "a" property, the property "c" proove it
}

What should be generated ;

public class a1 : classImplementINotify
{
    private string _a = String.Empty;
    public string a 
    { 
        get
        {
            return _a;
        } 
        set
        {
            _a = value;
            NotifyPropertyChanged("a"); // Notify HimSelf
            if (this is a2) // For not notify if the object is a simple a1, not an a2
                NotifyPropertyChanged("d"); // This is the "[DependsOn("a")]" of a2
        }    
    }
}

public class a2 : a1
{

    private string _c = String.Empty;
    public string c 
    {
        get
        {
            return _c;
        } 
        set
        {
            _c = value;
            NotifyPropertyChanged("c"); // Notify HimSelf
            NotifyPropertyChanged("a"); // This is the "[AlsoNotifyFor("a")]"
        }  
    }

    private string _d = String.Empty;
    public string d 
        get
        {
            return _d;
        } 
        set
        {
            _d = value;
            NotifyPropertyChanged("d"); // Just Notify HimSelf
        }  
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring @DependsOn inheritance behavior - java
So I've tried to put @DependsOn('b') to the abstract A -class only, but it didn't work: probably this annotation is not inherited. So...
Read more >
DependsOn project target does not work as expected #16138
The issue seems to be that DependsOn does not support specifying a specific project and target as a depends on. I may be...
Read more >
Cascade, specificity, and inheritance - Learn web development
Often, the problem is that you create two rules that apply different values of the same property to the same element. Cascade and...
Read more >
Authoring Tasks
These methods accept a task instance, a task name or any other input accepted by Task. dependsOn(java. lang. Object...).
Read more >
Declaring dependencies
Type-safe project dependencies​​ One issue with the project(":some:path") notation is that you have to remember the path to every project you want to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found