3

I'm moving a .NET WCF application to Mono for use in iOS. Because Mono in iOS does not support dynamic code generation, I need to override ClientBase.CreateChannel, as indicated in this post:

Monotouch/WCF: How to consume the wcf service without svcutil

This solution uses the generic ChannelBase<TChannel>. While this class is defined as an inner class of ClientBase<TChannel> in .Net 4.0, I couldn't find it in the Mono source. There appears to be an unimplemented version of the non-generic ChannelBase in System.ServiceModel.Channels, but I don't think this is used here.

If anyone has gotten this solution to work, could you please elaborate on how you accessed ClientBase<TChannel>?

Thanks.

Community
  • 1
  • 1
afreedm1
  • 256
  • 2
  • 6

1 Answers1

2

We eventually found ChannelBase<TChannel> as an inner class of ClientBase<TChannel>. It was marked as internal. We had to remove the internal modifier in order to use the class and recompile mono, but then the solution in the previously referenced post worked.

I can't explain why ChannelBase<TChannel> is marked as internal. This does not seem to match its definition in .Net.

afreedm1
  • 256
  • 2
  • 6
  • Looking at Mono's source code, it is marked as `protected internal` in Monotouch (which is based on the Silverlight profile) and `internal` in all other versions. Looking at the MSDN docs shows me that class only exists in Silverlight and .NET 4.0 and later. I suppose the reason for the `internal` modifier was that it didn't exist in .NET 2.0. I'll fix this for you. – Martin Baulig Nov 28 '12 at 11:31
  • Fixed in mono/master commit `c0e3517`. However, this should not affect Monotouch for you, the class was already marked as `protected` there. – Martin Baulig Nov 28 '12 at 11:48
  • Thanks Martin. Doesn't protected internal still mean that the class can only be used from within the assembly where it is defined? Generally, ChannelBase would be used in other assemblies that override the CreateChannel method, as in my case. – afreedm1 Nov 28 '12 at 15:35
  • No, it means either protected or internal - and it becomes protected outside the assembly that it's defined in. So when you override it, you use "protected override". – Martin Baulig Nov 28 '12 at 18:15