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.

Overridden properties no longer notified in 3.2.10

See original GitHub issue

I just updated a solution from Fody 2.6.1 and noticed different behavior in overridden properties. I checked a bunch of different versions and it starts happening when I upgrade from 3.2.9 to 3.2.10. That version made some changes regarding overridden properties.

PropertyChanged is the only weaver I’m using, the solution uses MSBuild 16, but the projects target .NET 4.7.2.

I don’t know what’s going wrong, so let me explain what I’m doing. I have a base, a folder, file and configuration. A folder contains multiple files as children, a file contains multiple configurations as children. Changes in children bubble up to their parent. That’s possibly not relevant, but I’ve added it to the repro at the bottom.

The base. (BaseViewModel only implements INotifyPropertyChanged)

internal class BaseFastenerViewModel : BaseViewModel
{
  public virtual Enums.FastenerType FastenerType { get; set; }
}

Folder:

internal class FolderViewModel : BaseFastenerViewModel
{
  private Enums.FastenerType _fastenerType;
  public override Enums.FastenerType FastenerType
  {
	get => _fastenerType;
	set
	{
	  _fastenerType = value;
	  if (value == Enums.FastenerType.Multiple || _skipUpdatingFastenerTypeOnChildren) return;
	  foreach (var child in Children) child.FastenerType = value;
	}
  }
  public ObservableCollection<BaseFastenerViewModel> Children { get; }
}

File

internal class FileViewModel : BaseFastenerViewModel
{
  private Enums.FastenerType _fastenerType;
  public override Enums.FastenerType FastenerType
  {
    get => _fastenerType;
    set
    {
      _fastenerType = value;
      if (value == Enums.FastenerType.Multiple || _skipUpdatingFastenerTypeOnChildren) return;
      foreach (var child in Children) child.FastenerType = value;
    }
  }
  public ObservableCollection<ConfigurationViewModel> Children { get; private set; } = new ObservableCollection<ConfigurationViewModel>();
}

The relevant section of the resulting code for FileViewModel in 2.6.1 up to 3.2.9 according to .NET Reflector: File fody old

And in 3.2.10: File fody 3 2 10

I created a small project where I can reproduce it: https://github.com/brinkdinges/fody-propertychanged-repro/tree/master/PropertyChanged

Regarding being a Patron; I just made my company CAD Booster one.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
tom-englertcommented, Nov 5, 2020

We did the check in the setter, but only if (any).set_Property() is called, so it interpreted child.set_Property as a call to base.set_Property, thus omitting the change notification.

1reaction
tom-englertcommented, Nov 4, 2020

I think this sample should work out of the box - we had added a check if the setter calls the base class setter, and, if not, it should notify.

I’ll have a look next weekend, to see what’s going wrong here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to override property in spring boot - java
Spring Boot automatically load application.properties from classpath (src/main/resources, if you are using Maven).
Read more >
Class NotificationChannelDescriptor (3.2.10) | Java client library
A description of a notification channel. The descriptor includes the properties of the channel and the set of labels or fields that must...
Read more >
bokeh.core.has_props
Get any theme-provided overrides. Results are returned as a dict from property name to value, or None if no theme overrides any values...
Read more >
Portal Properties - Index of / - Liferay
Each portal instance can have its own overriden property file following the convention portal-companyWebId.properties. To enable this feature, set the "company- ...
Read more >
Django 3.2 release notes
The Oracle backend now clones polygons (and geometry collections containing polygons) before reorienting them and saving them to the database.
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