Skip to content

Lazy formulas break when used with a serializing-type cache in nonstrict mode #3731

@jeff-hagen

Description

@jeff-hagen

When loading a cached entity (in nonstrict mode) with a lazy formula field for the first time, NH compares the value of the field with LazyPropertyInitializer.UnfetchedProperty to determine whether or not the field has been initialized. But when using a serializing cache (eg, Redis), the comparison fails because the deserialized instance of UnfetchedLazyProperty does not equal that of the LazyPropertyInitializer.UnfetchedProperty property, and instead tries to set the value of the entity property to LazyPropertyInitializer.UnfetchedProperty, which fails with an invalid cast exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions