alastairtree / LazyCache

An easy to use thread safe in-memory caching service with a simple developer friendly API for c#
https://nuget.org/packages/LazyCache
MIT License
1.72k stars 159 forks source link

Could not load LazyCache when using LazyCache.Ninject extension #78

Closed sekulicb closed 5 years ago

sekulicb commented 5 years ago

Hi. Thank you for the amazing library. I'm trying to load LazyCacheModule which is used during Kernel build up. I got the following exception:

Could not load file or assembly 'LazyCache, Version=2.0.0.104, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

The project is a WPF app targeting .NET Framework 4.7.2 and using VS2019.

Stack trace:

at LazyCache.LazyCacheModule.Load() at Ninject.Modules.NinjectModule.OnLoad(IKernel kernel) at Ninject.KernelBase.Load(IEnumerable1 m) at Ninject.KernelBase..ctor(IComponentContainer components, INinjectSettings settings, INinjectModule[] modules) at Ninject.StandardKernel..ctor(INinjectSettings settings, INinjectModule[] modules)`

Also, I'm using IAppCache inside Ninject Interceptor, but that happens way down the line...the exception described is thrown inside OnStartup event when the app is started. Any thoughts on this?

Thanks,

Bane

sekulicb commented 5 years ago

It's me again :) Since the real usage of IAppCache is in another project, the startup project just picks up LazyCache.Niject nuget package when LazyCacheModule is needed. I manually installed LazyCache nuget package, and it worked. Not sure if this was a problem with new VS2019 or maybe my nuget gone wild. But anyway, both packages are required in the startup project.

Sorry for the inconvenience, I'm closing the issue.

Thanks.