Skip to content

Support IEnumerable dependenciesΒ #72

@MGRussell

Description

@MGRussell

IEnumerables in constructor injection (and I assume, but have not tested, property injection) are currently not being initialized and left as null. They should be resolved by Locator.Current.GetServices().

Here is a helper method workaround in the meantime.

public static void ResolveIEnumerable<T>(ref IEnumerable<T> target)
{
    // https://github.com/reactivemarbles/Splat.DI.SourceGenerator/issues/72
    if (target != null)
    {
        throw new InvalidOperationException("This issue has been resolved. Remove this method.");
    }

    target = Locator.Current.GetServices<T>();
}

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