You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Calling UseDryIocDependencyResolver() with Akavache started throws this exception: code: Error.UnableToRegisterDuplicateKey; message: Unable to register service with duplicate key 'Akavache.IBlobCache': (Akavache.IBlobCache, LocalMachine) There is already registered service with the same key {FactoryID=149, ImplType=Akavache.InMemoryBlobCache, Reuse=Singleton {Lifespan=1000}}.
The problem seems to occur when Splat tries to initialize Akavache by calling InitializeAkavache() when the Locator is set.
Here is the call stack at the throwing statement (see attached screenshot) :
I investigated a little bit and it seems Akavache tries to register two singleton implementations of IBlobCache with the same key ({Akavache.IBlobCache}, "LocalMachine") in the DI container which causes the exception. DryIoc doesn't seem to be able to handle that specific case.
It first registers an IBlobCache from Akavache.Core and then another with the same key from Akavache.Sqlite3.
Note that the ISecureBlobCache registration will probably throw the same exception as they function the same way.
Steps To Reproduce
Create a minimal console app.
Add the Akavache, Splat and Splat.DryIoc packages to the project.
Register the application in Akavache.
Add a call to UseDryIocDependencyResolver().
A DryIoc.ContainerException is thrown.
I made a basic repro project here that replicates the issue.
Expected behavior
Akavache initialize properly and is registered in the DryIoc DI Container without issue.
Screenshots The exact line in DryIoc.Container where the exception is thrown
Environment(please complete the following information):
OS: Windows 11
Version: 22000
Device: Desktop
Additional context
Note that i managed to trigger this exception on an UWP project and console app, so this most likely isn't platform specific.
The text was updated successfully, but these errors were encountered:
Describe the bug
Calling
UseDryIocDependencyResolver()
with Akavache started throws this exception:code: Error.UnableToRegisterDuplicateKey; message: Unable to register service with duplicate key 'Akavache.IBlobCache': (Akavache.IBlobCache, LocalMachine) There is already registered service with the same key {FactoryID=149, ImplType=Akavache.InMemoryBlobCache, Reuse=Singleton {Lifespan=1000}}.
The problem seems to occur when Splat tries to initialize Akavache by calling
InitializeAkavache()
when the Locator is set.Here is the call stack at the throwing statement (see attached screenshot) :
I investigated a little bit and it seems Akavache tries to register two singleton implementations of
IBlobCache
with the same key({Akavache.IBlobCache}, "LocalMachine")
in the DI container which causes the exception. DryIoc doesn't seem to be able to handle that specific case.It first registers an
IBlobCache
fromAkavache.Core
and then another with the same key fromAkavache.Sqlite3
.Note that the
ISecureBlobCache
registration will probably throw the same exception as they function the same way.Steps To Reproduce
UseDryIocDependencyResolver()
.DryIoc.ContainerException
is thrown.I made a basic repro project here that replicates the issue.
Expected behavior
Akavache initialize properly and is registered in the DryIoc DI Container without issue.
Screenshots
The exact line in
DryIoc.Container
where the exception is thrownEnvironment(please complete the following information):
Additional context
Note that i managed to trigger this exception on an UWP project and console app, so this most likely isn't platform specific.
The text was updated successfully, but these errors were encountered: