I am trying to use a .NET Standard 1.2 library from a Windows Phone 8.1 Project. It Compiles fine but at runtime i get this exception The type 'Dictionary<,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. I have checked all my nuget packages and are correct in both projects.
In order to find a solution to my problem I tried to put the code snippet that throws the exception directly on the w phone 8.1 project to see what exception will be thrown (before the code executed on another dll library). When I executed the code this is what i got :
Could not load file or assembly 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
code snippet :
var type = Type.GetType("oda.Repositories.ProductRepository, oda.Repositories, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
var repository = Activator.CreateInstance(type, null) as IProductRepository; <<<this is where the exception is thrown.>>>
PS : the same code executes fine when consumed from a wpf desktop application.
Any help???!!!!
Thank You!!