We have a WPF application that uses Unity to resolve it's dependencies. It works fine on different computers but if we try to run it on a machine with Intel Atom Processor with 2 GB RAM (Intel Compute Stick) we get an System.OutOfMemoryException when initializing unity with this line:
var unityContainer = new UnityContainer();
This machine runs on Windows 8, 32 Bit.
We also tried to create a simple new application that has no dependencies except for Unity and does nothing but creating the UnityContainer - we always get the exception.
We're using the NuGet package (3.5.1404.0).
Here are the Details from the exception we get from the system:
Problemsignatur: Problemereignisname: CLR20r3 Problemsignatur 01: WpfApplication1.exe Problemsignatur 02: 1.0.0.0 Problemsignatur 03: 5566d036 Problemsignatur 04: Microsoft.Practices.Unity Problemsignatur 05: 3.5.1404.0 Problemsignatur 06: 5355503f Problemsignatur 07: 9f Problemsignatur 08: b Problemsignatur 09: System.OutOfMemoryException Betriebsystemversion: 6.3.9600.2.0.0.768.101 Gebietsschema-ID: 1031 Zusatzinformation 1: 5861 Zusatzinformation 2: 5861822e1919d7c014bbb064c64908b2 Zusatzinformation 3: 31c4 Zusatzinformation 4: 31c4f0c30ca267a761c69930266146b1
We also downloaded the older Version (3.0) from https://www.microsoft.com/en-us/download/details.aspx?id=38788 . With this Version all works fine.
Does anybody have an idea?
Regards, Chris
I think you need to provide a mapping between the interface and the implementation.
For Example :
public interface IInterfaceName { }
public class InterfaceImpl : IInterfaceName { }
IUnityContainer container = new UnityContainer();
container.RegisterType<IInterfaceName,InterfaceImp(typeof(InterfaceImpl).Name);
IInterfaceName interfaceClass = container.Resolve<IInterfaceName(typeof(InterfaceImp).Name);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.