Skip to content

The "PerResolve" lifetime is not properly respected when the resolving interception behaviors for an object #44

Open
@MikeCook9994

Description

@MikeCook9994

I've noticed some recent activity on these repos so I'm going to shoot my shot.

I am upgrading some code (that's an understatement) from Unity 3 to Unity 5 and have encountered what is either a bug or a significant behavioral difference regarding interception between the versions.

In Unity 5.11 (and likely earlier versions, I haven't explored deep enough to find where the issue starts), Unity will re-resolve objects registered with the "PerResolveLifetimeManager" when resolving objects needed for any defined interception behavior. I have verified that the same object will be used across the object graph for any reference that is not part of interception behavior.

Here is a test case that should demonstrate the issue. I tried another lifetime ("PerThread") to demonstrate that it does seem to specifically be an issue with "PerResolve".

UnityPerResolveInterceptionBrokenPoc.zip

I've pulled the interception repo and have been trying to uncover the issue, but I'm quite a bit out of my depth. Depending on the scope of the fix (I would have to evaluate fixing this vs other options for my team to consider), I'd be willing to submit a PR if I can get pointed in the right direction.

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