Closed mcdis closed 6 years ago
SOLVED becouse wrong IUiMenuSettingsItemEditor registration, but the question is still open why TryLocate throw exception
@mcdis I'm not sure I follow the example. Are you expecting the container to catch the exception or are you expecting the container not to throw an exception when a child dependency is missing on an export that is found?
I've wrong lifecycle configuration in root container for some type. I used singleton instead per request, but TryLocate instead return false throw exception in child container. If I understood right TryLocate by design have not to throw exception but sometimes it throw, See Nessage and stacktrace.
@mcdis the intention of TryLocate is to attempt to locate an export that matches the requested type. It does not walk it's way down the dependency graph testing to see if children can be resolved. What you are describing would be far to costly performance wise also from my stand point it just masks the real problem in the container configuration.
I do not envision Grace changing for this use case.
Code:
where:
child container configuration behaviors:
Message
StackTrace:
if I remove
IUiMenuSettingsJsonSettingProvider _settings
from constructor of UiMenuItemContainerEditor all works,