Skip to content

Need way to opt out of running OptimizingFactory in a worker thread (Task.Factory.Startnew) #197

@PeterOscarsson

Description

@PeterOscarsson

Description

UnityContainer.Resolution.cs
private static ResolveDelegate OptimizingFactory(ref BuilderContext context)

Some way to either opt out of running the optimization (lambda.compile...) in a separate thread, or some way to pre-build the optimization so it wont happen during Resolve

Problem

I have found some cases where Starting a new Task inside an already runing Task.Factory.StartNew will create a StackOverflow Exception. I have a Testcase but it involves quite a lot of code, I'm working on a "smaller" version.
It may have something to do with a Polly Bulkhead Policy but thats just a guess right now.

Solution

I do not want the Container to call Task.Factory.StartNew during a Resolve.

Impact

If it is optional to optout then no impact to existing code

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