Open jesperll opened 4 years ago
Would you like to send a PR for this?
I would love to send a PR but I'm unsure how that works with your project structure (submodules). Do I make a pull request against unitycontainer/container or unitycontainer/unity or both?
The dispose implementation is in Container project
@ENikS It looks like the PR tests are run only within the context of the container project and therefore not finding the rest of the needed classes making them fail with stuff completely unrelated to my changes. How do I get them to run in the context of the full project?
When calling Container.Dispose() if a single object throws an exception it gets rethrown in a way that replaces the original stacktrace with one that only includes Container.Dispose()
This makes it impossible to log what fails in a released app. All you get is Container.Dispose threw an exception.
If multiple objects throw exceptions they're wrapped in an AggregateException keeping their original stacktraces intact.
A better way would be to rethrow using ExceptionDispatchInfo.Capture(exceptions[0]).Throw(); This would keep the original stacktrace.
ExceptionDispatchInfo is available in NET45 and NETStandard10 so NET40 would need to keep throwing as it does today.
LifeTimecontainer.Dispose has the exact same issue
ConstructorResolution.ResolveDelegate and DynamicBuildPlanGenerationContext.GetBuildMethod may also have the issue but I'm not entirely sure what the consequence would be here