0

I have updated DryIoc from version 4.8.8 to 5.4.1 and Automapper from version 10.1.1 to 12.0.1. Previously, I registered Automapper using the following method:

services.AddAutoMapper(options =>
            {
                options.ForAllMaps((obj, options) => options.ForAllMembers(o => o.Condition((src, dest, member) => member != null)));
            }, typeof(Responce<>));

However, the ForAllMaps() method has been moved:

services.AddAutoMapper(options =>
            {
                options.Internal().ForAllMaps((obj, options) => options.ForAllMembers(o => o.Condition((src, dest, member) => member != null)));
            }, typeof(Responce<>));

And now when I call the mapper, I get the following error:

Error.WaitForScopedServiceIsCreatedTimeoutExpired; message: DryIoc has waited for the creation of the scoped or singleton service by the "other party" for the 3000 ticks without the completion. You may call exception.TryGetDetails(container) to get the details of the problematic service registration. The error means that either the "other party" is the parallel thread which has started but is unable to finish the creation of the service in the provided amount of time. Or more likely the "other party" is the same thread and there is an undetected recursive dependency or the scoped service creation is failed with the exception and the exception was catched but you are trying to resolve the failed service again. For all those reasons DryIoc has a timeout to prevent the infinite waiting. You may change the default timeout via Scope.WaitForScopedServiceIsCreatedTimeoutTicks=NewNumberOfTicks

What is the correct way to register Automapper in DryIoc?

0 Answers0