Skip to content

StackOverflowException for lazy proxied entities with explicit interface properties #1628

@ghost

Description

In a domain model where PKs are not always of the same type, a fairly complex architecture of interfaces and classes is defined.
Said architecture provide for:

  • a IEntity defining a object Id { get; } property

  • a IEntity<T> : IEntity defining a new T Id { get; } property

Hence, every domain object has to implement both:

  • a object IEntity.Id { get { return Id; } }

  • and a public virtual T Id { get; }

To make things even more complicated, some entities has lazy fields on them and a IPostLoadEventListener is used.

Problem is: all this machinery functioned pretty well... up until the latest release of NHibernate.
In 5.1, for all entities with lazies, when trying to access the aforementioned Id property inside of the IPostLoadEventListener, a StackOverflowException is thrown.

Please note that all three elements above are needed for the bug to trigger.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions