Note that there are some explanatory texts on larger screens.

plurals
  1. POAn unhandled exception of type 'System.StackOverflowException' occurred in System.Core.dll
    primarykey
    data
    text
    <p>In my Asp.net MVC project</p> <p>I have a bootsrapper that initialize a unity-container.</p> <p>I don't know why, but I get </p> <blockquote> <p>An unhandled exception of type 'System.StackOverflowException' occurred in System.Core.dll</p> </blockquote> <p>I have doubled checked and registration is done only in my initializer.</p> <p>All dependencies are injected in the ctors only.</p> <p>What could have caused this?</p> <pre><code> protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); Initializer.Initialize(); BundleConfig.RegisterBundles(BundleTable.Bundles); } </code></pre> <p>It fails after <code>BundleConfig.RegisterBundles(BundleTable.Bundles);</code></p> <pre><code>public static class Initializer { private static bool isInitialize; private static readonly object LockObj = new object(); private static IUnityContainer defaultContainer = new UnityContainer(); static Initializer() { Initialize(); } public static void Initialize() { if (isInitialize) return; lock (LockObj) { IUnityContainer container = defaultContainer; //registering Unity for MVC DependencyResolver.SetResolver(new UnityDependencyResolver(container)); //registering Unity for web API // GlobalConfiguration.Configuration.DependencyResolver = new Unity.WebApi.UnityDependencyResolver(container); #region managers container.RegisterType&lt;ISettingsManager, SettingsManager&gt;(); container.RegisterType&lt;IMamDataManager, MamDataManager&gt;(); container.RegisterType&lt;IAppsDataManager, AppsDataManager&gt;(); #endregion #region Dals container.RegisterType&lt;IDal&lt;ClientService.DAL.EntityFramework.App&gt;, AppsDal&gt;(); #endregion Dals #region cache container.RegisterType&lt;ICache&lt;string, ClientService.DAL.EntityFramework.Group&gt;, GroupsCache&gt;(new ContainerControlledLifetimeManager()); container.RegisterType&lt;ICache&lt;string, ClientService.DAL.EntityFramework.App&gt;, AppsCache&gt;(new ContainerControlledLifetimeManager()); container.RegisterType&lt;ICache&lt;string, SettingsServiceData&gt;, SettingsServiceDataCache&gt;(new ContainerControlledLifetimeManager()); #endregion cache #region Pollers container.RegisterType&lt;IPoller&lt;ClientService.DAL.EntityFramework.Group&gt;, GroupsPoller&gt;(new ContainerControlledLifetimeManager()); container.RegisterType&lt;IPoller&lt;ClientService.DAL.EntityFramework.App&gt;, AppsPoller&gt;(new ContainerControlledLifetimeManager()); container.RegisterType&lt;IPoller&lt;SettingsServiceData&gt;, SettingsPoller&gt;(new ContainerControlledLifetimeManager()); #endregion Pollers container.RegisterType&lt;IDefaultConfigurationGroupSingleton, DefaultConfigurationGroupSingleton&gt;(new ContainerControlledLifetimeManager()); container.RegisterType&lt;IApplicationLogger, Log4NetLogger&gt;(); if (!isInitialize) { isInitialize = true; } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload