Skip to content

[BUG] PropertyChanged events weaved by ReactiveUI.Fody do not get fired under specific conditions #2114

@ashelleyPurdue

Description

@ashelleyPurdue

Describe the bug
Under a very specific set of circumstances, the PropertyChanged event of a ReactiveObject weaved by Fody will not be fired when you change a property's value.

These conditions are:

  • You must be using .Net Core 3.0
  • You must be in a WPF project. It does not appear in console applications or unit tests.
  • You must subscribe to the PropertyChanged event with a lambda expression
  • Said lambda expression must capture at least one value from the enclosing function.
  • You cannot subscribe to a button click event in the same function that you subscribed to PropertyChanged.

If ANY of the above conditions are NOT met, the bug will NOT appear.

To demonstrate, I've prepared a super-small project, because code speaks louder than comments: https://github.com/ashelleyPurdue/here_is_a_very_specific_bug_that_i_would_like_to_showcase

The glitched behavior occurs in the project named "Core"(which, predictably, uses .Net Core), but not in the project named "Framework"(which--you guessed it-- uses .Net Framework).

Steps To Reproduce

  • Clone the repo mentioned above
  • Set "Core" as your startup project
  • Launch it
  • Click the button

Expected behavior
The following four message boxes should pop up:

  • "It works if you capture something in the same function that you subscribe to changeButton.Click.0"
  • "It works if we don't capture any values."
  • "It doesn't work if we capture something.0"

Actual behavior
The last message in the list does not pop up.

Environment

  • OS: Windows 10
  • Version: 1903
  • Devices tested: Microsoft Surface Go, Lenovo Thinkstation, and a crappy self-built PC I have at home.

Additional context
The original title of this issue was going to be "PropertyChanged events weaved by ReactiveUI.Fody in a .Net Core 3.0 WPF project do not get fired if the subscribed handler is a lambda expression that captures at least one value, UNLESS you also subscribe a different lambda to a completely unrelated button click event in the same function", but for some reason Github thought that was too long. I can't imagine why.

I really, REALLY need a drink after all of this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions