Skip to content

[Bug]: null values handling with OAPH ToProperty #63

@Geccoka

Description

@Geccoka

Describe the bug 🐞

Having an IObservable<EventSpeaker> CurrentSpeaker observable to which i subscribe like this:

CurrentSpeaker
    .ToProperty(this, x => x.CurrentSpeaker, out _currentSpeakerHelper)
    .DisposeWith(_compositeDisposable);

After a speaker has spoken this observable will send a NULL value to its subscribers.

I am migrating away from Fody to the new source generators, and have an issue with this use case. The generated code for the CurrentSpeaker is:

public global::EventSpeaker CurrentSpeaker { get => _currentSpeaker = (_currentSpeakerHelper?.Value ?? _currentSpeaker); }

The problem is that the _currentSpeakerHelper.Value is null and the _currentSpeaker contains the previous value and because of the ?? operator the previous value will be provided and not the null.

This issue was introduced in #28 i think.

Expected behavior

The null value should be set for the generated property.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions