Search code examples
unity-container

Unity's ResolutionFailedException


I have an old Asp.Net web application using Unity for dependency injection. Today I updated the Unity using NuGet to the latest version. On trying to run the application, I am getting an exception:

Unity.Exceptions.ResolutionFailedException: 'Resolution of the dependency failed, type = 'SOME.Services.ISomeService', name = '(none)'. Exception occurred while: while resolving. Exception is: InvalidOperationException - The property converter on type DAL.Repositories.SomeRepository is not settable.

The exception happened on line

_someService = container.Resolve<ISomeService>();

I am very new to Unity. Could you please help?


Solution

  • The newer versions of Unity have breaking changes.
    You may want to stick with the older versions of the DLL until you refactor the changes.

    v4.0.1 Version 4.x is dead. Loss of original signing certificate made it impossible to release anything compatible with v4.0.1 release. To give original developers a credit only about 60 issues were found during two years in production. To move on and enable further development version v5 has been created.

    v5.x Version 5.x is created as replacement for v4.0.1. Assemblies and namespaces are renamed and refactored but otherwise it is compatible with the original. v5.0.0 release fixes most of the issues found in v4.0.1 and implements several optimizations but the accent was on compatibility and if optimization would break API it was omitted. Once stabilized, this version will enter LTS status and will be patched and fixed for the next few years. There will be no significant development in this line.

    Check their road map here.