I have a console application that loads other libraries (DLL's). I'm using Spring.NET. My console application is very simple, load the app.config that is configured through DI to initialize the chosen library.
Code
ContextRegistry.GetContext();
Configuration (app.config)
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context"
type="Spring.Context.Support.ContextHandler, Spring.Core"/>
<section name="objects"
type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
</sectionGroup>
</configSections>
<spring>
<context>
<resource uri="config://spring/objects"/>
<resource uri="assembly://MyDLL/MyDLL.Config/Services.xml"/>
</context>
<objects xmlns="http://www.springframework.net"
xmlns:aop="http://www.springframework.net/aop">
</objects>
</spring>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup></configuration>
Each library has its own "services.xml" file. These libraries also use Spring.NET.
<objects xmlns="http://www.springframework.net"
xmlns:aop="http://www.springframework.net/aop">
<object id="componentObj"
type="MyDLL.Services.ComponentService, MyDLL"
singleton="true" />
<object
id="componentServiceHost"
type="Spring.ServiceModel.Activation.ServiceHostFactoryObject, Spring.Services">
<property name="TargetName"
value="componentObj" />
</object>
</objects>
Getting a excpetion "Process is terminated due to StackOverflowException." If I comment out the <object id="componentServiceHost"
, the exception does not occur.
The VS console in debug shows
A first chance exception of type 'System.InvalidOperationException' occurred in System.ServiceModel.dll
A first chance exception of type 'Spring.Objects.Factory.ObjectCreationException' occurred in Spring.Core.dll
A first chance exception of type 'Spring.Objects.Factory.ObjectCreationException' occurred in Spring.Core.dll
Managed (v4.0.30319)' has exited with code -2147023895 (0x800703e9).