jan.haug


I tried to cast a ChannelFactory-created proxy to IClientChannel to find out the State of the Channel like joe zhou - MSFT said; http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1125710&SiteID=1

But in Debug-Mode when I add a watch of DirectCast(MyProxy, IClientChannel).State it says that it is unable to cast MyProxy to IClientChannel.

Thx for helping.



Re: Cast Proxy to IClientChannel

Carlos Figueira - MSFT


Can you add a code snippet on how you're creating the proxy As long as you're using ChannelFactory<T>.CreateChannel() to create the proxy, the conversion to IClientChannel should work. Also, can you send the result of MyProxy.GetType().FullName





Re: Cast Proxy to IClientChannel

jan.haug

I create the channel this way:

Code Block

m_BusinessFacade = WcfChannel(Of IDataFacade).CreateChannel

m_BusinessFacade.GetType().FullName returns MyCompany.MyCompany64.Common.BusinessLayerInterfaces.IDataFacade

It's funny. The casting works but not as watch in the debug mode. I though if the casting fails in the debug mode, it will also fail on runtime. Why can VS not cast the type as a watchpoint






Re: Cast Proxy to IClientChannel

Ram Venkatesan - MSFT

Hi

I am assuming this is now more of a VS behavior than a WCF behavior. You might want to post this in the VS forums.

Thanks