ProcessInjection proxy impedes debugging

Topics: Policy Injection Application Block
Jul 3, 2008 at 3:28 PM
I've started using the ProcessInjection and the effect on debugging is not very nice.

If I mouse over a type that has been replaced by a PI proxy, none of the properties show the values, they show System.Reflection.TargetExeception...

If I add the theObject.SomeProperty to the watch, I get Cannot obtain fields or call methods on the instance of type 'ITheObject' because it is a proxy to a remote object.

Is there a way to use the PI block so that debugging remains functional?
Jul 4, 2008 at 3:05 PM

Hi Andrew,

That's a valid concern. You can work around this to some extent by doing something like:

((Microsoft.Practices.EnterpriseLibrary.PolicyInjection.RemotingInterception.InterceptingRealProxy) System.Runtime.Remoting.RemotingServices.GetRealProxy(customers[0])).Target.

It's not ideal, but will let you add a watch you can use.

Fernando

 


AndrewSeven wrote:
I've started using the ProcessInjection and the effect on debugging is not very nice.

If I mouse over a type that has been replaced by a PI proxy, none of the properties show the values, they show System.Reflection.TargetExeception...

If I add the theObject.SomeProperty to the watch, I get Cannot obtain fields or call methods on the instance of type 'ITheObject' because it is a proxy to a remote object.

Is there a way to use the PI block so that debugging remains functional?


Jul 4, 2008 at 3:14 PM
Thanks,

I guess I could write a debugging visualizer to do the grunt work.

Is this a permanent issue or could something be done to fix it?

-A
Jul 4, 2008 at 3:57 PM
Hi,

Well, you could navigate the TP's raw view to get to the target (Raw View/_rp/InterceptingRealProxy/Target) so you don't need to create a visualizer.

Is it a permanent issue? I'm not sure. I toyed with a RealProxy implementation that would intercept the call to GetType() and return the type to proxy (potentially the interface) instead of what the wrapped object's type (always a class); this "fixed" the locals view and also the type descriptor, which is the cause for the binding failure you discussed in different thread, but I'm afraid something would eventually break because of that change.

Fernando


AndrewSeven wrote:
Thanks,

I guess I could write a debugging visualizer to do the grunt work.

Is this a permanent issue or could something be done to fix it?

-A


Jul 4, 2008 at 10:42 PM
Ya, thats pretty much all the visualizer would do :)

Thanks 
Dec 28, 2009 at 1:20 AM

One nice thing about Visual Studio 2010 (beta) is that you can pin that nested Raw View/_rp/InterceptingRealProxy/Target property so you can re-evaluate the value fairly easily. It's still not pretty or intuitive to find that property each time but...works for now ;)