2009-04-21 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Tue, 21 Apr 2009 15:30:16 +0000 (15:30 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Tue, 21 Apr 2009 15:30:16 +0000 (15:30 -0000)
* ClientBase.cs (NET_2_1): Change cctor not to require being
[SecuritySafeCritical] and drop IDisposable.

svn path=/trunk/mcs/; revision=132269

mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog
mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs

index eec78b909b0696ca7eb5fa602e8370fc638ddc8d..2370cf9849c65b95109affcf0f753d8afb611622 100755 (executable)
@@ -1,3 +1,8 @@
+2009-04-21  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * ClientBase.cs (NET_2_1): Change cctor not to require being 
+       [SecuritySafeCritical] and drop IDisposable.
+
 2009-04-21  Atsushi Enomoto  <atsushi@ximian.com>
 
        * PeerNode.cs : remove extra field.
index 54fe7e64bfd0176b3671bdb0b21009ecd636c8a3..3f053741f66c86875b0aab589ce24d1f58aafd8b 100644 (file)
@@ -37,8 +37,11 @@ using System.Threading;
 namespace System.ServiceModel
 {
        [MonoTODO ("It somehow rejects classes, but dunno how we can do that besides our code wise.")]
-       public abstract class ClientBase<TChannel>
-               : IDisposable, ICommunicationObject where TChannel : class
+       public abstract class ClientBase<TChannel> :
+#if !NET_2_1
+               IDisposable,
+#endif
+               ICommunicationObject where TChannel : class
        {
                static InstanceContext initialContxt = new InstanceContext (null);
 #if NET_2_1
@@ -47,15 +50,13 @@ namespace System.ServiceModel
 
                static ClientBase ()
                {
-                       foreach (Assembly ass in AppDomain.CurrentDomain.GetAssemblies ()) {
-                               if (ass.GetName ().Name != "System.Windows")
-                                       continue;
-                               Type dispatcher_type = ass.GetType ("System.Windows.Threading.Dispatcher", true);
-                               dispatcher_main_property = dispatcher_type.GetProperty ("Main", BindingFlags.NonPublic | BindingFlags.Static);
-                               dispatcher_begin_invoke_method = dispatcher_type.GetMethod ("BeginInvoke", new Type [] {typeof (Delegate), typeof (object [])});
-                       }
+                       Type dispatcher_type = Type.GetType ("System.Windows.Threading.Dispatcher, System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e", true);
+
+                       dispatcher_main_property = dispatcher_type.GetProperty ("Main", BindingFlags.NonPublic | BindingFlags.Static);
                        if (dispatcher_main_property == null)
                                throw new SystemException ("Dispatcher.Main not found");
+
+                       dispatcher_begin_invoke_method = dispatcher_type.GetMethod ("BeginInvoke", new Type [] {typeof (Delegate), typeof (object [])});
                        if (dispatcher_begin_invoke_method == null)
                                throw new SystemException ("Dispatcher.BeginInvoke not found");
                }
@@ -272,13 +273,12 @@ namespace System.ServiceModel
                        begin_async_result = beginOperationDelegate (inValues, cb, userState);
                }
                IAsyncResult begin_async_result;
-#endif
-               
+#else
                void IDisposable.Dispose ()
                {
                        Close ();
                }
-
+#endif
                protected virtual TChannel CreateChannel ()
                {
                        return ChannelFactory.CreateChannel ();