-
-
Notifications
You must be signed in to change notification settings - Fork 72
Description
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