Policy Injection using Exception Handling and IConfigurationSource

Topics: Exception Handling Application Block, Logging Application Block, Policy Injection Application Block
Oct 11, 2007 at 4:21 AM

I had sold my enterprise on using the policy injection application block for logging and exception management. In the process of implementing my first application using the PIAB, i think I have disconvered a bug that will not allow us to move forward. We have to use a seperate config file than our app.config file due to the hosting application not being a .NET application and it not understand all the tags. When I try to call:

private IConfigurationSource _source =
new FileConfigurationSource(@"C:\test.config");

object= PolicyInjection.Create<object>(source, args);

The PIAB will eventual call:

ExceptionCallHandlerData :

public ICallHandler Assemble(IBuilderContext context, CallHandlerData objectConfiguration,
IConfigurationSource configurationSource,
ConfigurationReflectionCache reflectionCache)
ExceptionCallHandlerData handlerData = (ExceptionCallHandlerData) objectConfiguration;

ExceptionCallHandler handler = new ExceptionCallHandler(handlerData.ExceptionPolicyName);
return handler;

which always creates ExceptionCallHandler using the default application config file. This will throw a null exception error. So there is no way to use the policy injection block with a config file other than the default app.config. This will not allow us to use the EntLib without modifing the source which is something we did not want to do.