PIAB: Configured exception policy disappears

Topics: Policy Injection Application Block
Sep 5, 2007 at 8:44 AM
I've specifed an Exception Handling Handler for a PIAB policy. The specifed exception policy for the exception handling handler disappears when I save en reopen the config. The policy is set to 'none' when reopening the file. I think the policy is saved properly since I can see it in the file:

<add exceptionPolicyName="SomeExceptionPolicy"
type="Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers.ExceptionCallHandler, Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="Exception Handling Handler" />

Any ideas how I can solve this?

Gerben.
Sep 5, 2007 at 11:57 AM
Hi Gerben,

Is the policy referenced by the handler persisted in the configuration file? It might be the case that the policy name is wrong for some reason and it cannot be resolved for the handler node, so the issue would be originated elsewhere.

Fernando
Sep 7, 2007 at 1:33 PM
Yes it is persisted. Here is what I'm doing:

- Start config console
- New application
- New exception handling block
- New policy ("MyPolicy")
- New policy injection block
- New policy
- New Exception Handling Handler
- Set exception policy to "MyPolicy"
- Save config file
- Close config console

Handler is persisted at this moment when I open the file by hand in notepad.

- Open config console
- Open config file
- Exception policy is set to (none)

Any ideas what is hapening?
Sep 7, 2007 at 1:34 PM
Here is my config that is saved to disk:

<configuration>
<configSections>
<section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<section name="policyInjection" type="Microsoft.Practices.EnterpriseLibrary.PolicyInjection.Configuration.PolicyInjectionSettings, Microsoft.Practices.EnterpriseLibrary.PolicyInjection, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</configSections>
<exceptionHandling>
<exceptionPolicies>
<add name="MyPolicy" />
</exceptionPolicies>
</exceptionHandling>
<policyInjection>
<policies>
<add name="Policy">
<handlers>
<add exceptionPolicyName="MyPolicy" type="Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers.ExceptionCallHandler, Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="Exception Handling Handler" />
</handlers>
</add>
</policies>
</policyInjection>
</configuration>
Sep 7, 2007 at 1:51 PM
Hi Gerben,

I just pasted your config to a notepad, saved it as a .config file and opened it the config tool; the reference to the policy was fine.
Of course I trust your description of the situation, so I suspect there is a aspect about your computer that might be causing this problem. Maybe the language? The exception policy node is resolved by a string comparison without a culture, so this might be the cause.

if (string.Compare(exceptionPolicyName, exceptionPolicyNode.Name) == 0)
{
ExceptionPolicy = exceptionPolicyNode;
break;
}

Regards,
Fernando
Sep 13, 2007 at 10:50 AM
I wanted to try to debug that piece of code, but everything works fine when using the config console from the sources. The difference is that this console is using the unsigned assemblies.

My language is set to english, so I don't think can cause problems.

Any other ideas what's going on here?

Gerben.
Sep 17, 2007 at 2:24 PM
Hi Gerben,

When it doesn't work with the signed binaries, does the exception policy get loaded at all? I mean, is it just the reference on the exception call handler that is wrong but the referenced node is loaded, or the referenced node is missing too?

Regards,
Fernando
Sep 18, 2007 at 9:09 AM
It is just the reference on the exception call handler. The exception policy itself gets loaded properly.

Gerben.
Jan 27, 2008 at 9:15 PM
Edited Jan 27, 2008 at 9:17 PM
Hey,

I'm having this same problem when using the signed dlls with both EntLibContrib.PolicyInjection.dll and EntLibContrib.PolicyInjection.Design.dll in the Bin folder. If I remove both of these dlls from the Bin folder (they are the only two EntLibContrib dlls I have there at the moment, if that's relevent), everything works again.

Any idea why having these two dlls there results in the exception policy reference not loading properly?


Thanks