PolicyInjection and Windows Forms

Topics: Policy Injection Application Block
Jan 8, 2009 at 7:11 PM


I have a question regarding the Policy Injection Application Block (in Entlib 4.1) and logging. I am trying to use PolicyInjection.Create<MyForm>() but its not working. If I make MyForm implement an interface (e.g. IMyForm) then PolicyInjection.Create<MyForm, IMyForm>() will allow the logging to work. MyForm inherits from Form, which eventually inherits from MarshalByRefObject, so I would have thought the first case should have worked?

Can anyone shed any light on this?



P.S. I've seen thread id 9149 which may explain it, but that was from April 2007 so I'm guessing it wouldn't be relevant for Oct 2008 release?

Jan 9, 2009 at 1:23 AM
Yes, it should work.  I actually just tried it right now and I was able to intercept my methods in my windows form.  You might be missing something in your policy injection configuration.

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.