Explorar o código

In some collection case, xsi:type is explicitly written. Try to copy that behavior.

Atsushi Eno %!s(int64=15) %!d(string=hai) anos
pai
achega
d7796bf493

+ 2 - 1
mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterSerializer.cs

@@ -102,7 +102,8 @@ namespace System.Runtime.Serialization
 				// For some collection types, the actual type does not matter. So get nominal serialization type instead.
 				// (The code below also covers the lines above, but I don't remove above lines to avoid extra search cost.)
 				if (map == null) {
-					actualType = types.GetSerializedType (actualType);
+					// FIXME: not sure if type.IsInterface is the correct condition to determine whether items are serialized with i:type or not. (e.g. bug #675144 server response).
+					actualType = types.GetSerializedType (type.IsInterface ? type : actualType);
 					map = types.FindUserMap (actualType);
 				}
 				// If it is still unknown, then register it.

+ 1 - 0
mcs/class/System.Runtime.Serialization/System.Runtime.Serialization_test.dll.sources

@@ -1,4 +1,5 @@
 System.Runtime.Serialization/Bug666333Test.cs
+System.Runtime.Serialization/Bug675144Test.cs
 System.Runtime.Serialization/DataContractResolverTest.cs
 System.Runtime.Serialization/XmlObjectSerializerTest.cs
 System.Runtime.Serialization/XsdDataContractExporterTest.cs

+ 531 - 0
mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/Bug675144Test.cs

@@ -0,0 +1,531 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Runtime.Serialization;
+using System.ServiceModel;
+using System.ServiceModel.Channels;
+using System.ServiceModel.Description;
+using System.Xml;
+using WebServiceMoonlightTest.ServiceReference1;
+using NUnit.Framework;
+
+namespace MonoTests.System.Runtime.Serialization
+{
+	[TestFixture]
+	public partial class Bug675144Test
+	{
+		[Test]
+		public void ServerSerialization ()
+		{
+			var obj = new DataType2 { Items = new List<DataType1> { new DataType1 { Id = "D" }, new DataType1 { Id = "E" } } };
+			var ds = new DataContractSerializer (typeof (DataType2));
+			var sw = new StringWriter ();
+			using (var xw = XmlWriter.Create (sw))
+				ds.WriteObject (xw, obj);
+			Assert.IsTrue (sw.ToString ().IndexOf ("anyType i:type=\"DataType1\"") > 0, "#1");
+		}
+	}
+}
+
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.372
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+// 
+// This code was auto-generated by Microsoft.Silverlight.ServiceReference, version 4.0.50826.0
+// 
+namespace WebServiceMoonlightTest.ServiceReference1 {
+    using System.Runtime.Serialization;
+    
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
+    [System.Runtime.Serialization.DataContractAttribute(Name="DataType1", Namespace="http://mynamespace")]
+    public partial class DataType1 : object, System.ComponentModel.INotifyPropertyChanged {
+        
+        private string IdField;
+        
+        [System.Runtime.Serialization.DataMemberAttribute()]
+        public string Id {
+            get {
+                return this.IdField;
+            }
+            set {
+                if ((object.ReferenceEquals(this.IdField, value) != true)) {
+                    this.IdField = value;
+                    this.RaisePropertyChanged("Id");
+                }
+            }
+        }
+        
+        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
+        
+        protected void RaisePropertyChanged(string propertyName) {
+            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
+            if ((propertyChanged != null)) {
+                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
+            }
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
+    [System.Runtime.Serialization.DataContractAttribute(Name="DataType2", Namespace="http://mynamespace")]
+    [System.Runtime.Serialization.KnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference1.DataType1))]
+    [System.Runtime.Serialization.KnownTypeAttribute(typeof(System.Collections.Generic.IEnumerable<object>))]
+    public partial class DataType2 : object, System.ComponentModel.INotifyPropertyChanged {
+        
+        private System.Collections.Generic.IEnumerable<object> ItemsField;
+        
+        [System.Runtime.Serialization.DataMemberAttribute()]
+        public System.Collections.Generic.IEnumerable<object> Items {
+            get {
+                return this.ItemsField;
+            }
+            set {
+                if ((object.ReferenceEquals(this.ItemsField, value) != true)) {
+                    this.ItemsField = value;
+                    this.RaisePropertyChanged("Items");
+                }
+            }
+        }
+        
+        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
+        
+        protected void RaisePropertyChanged(string propertyName) {
+            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
+            if ((propertyChanged != null)) {
+                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
+            }
+        }
+    }
+    
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+    [System.ServiceModel.ServiceContractAttribute(Namespace="http://mynamespace", ConfigurationName="ServiceReference1.IService1")]
+    public interface IService1 {
+        
+        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetData", ReplyAction="http://mynamespace/IService1/GetDataResponse")]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference1.DataType1))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference1.DataType2))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.IEnumerable<object>))]
+        System.IAsyncResult BeginGetData(System.AsyncCallback callback, object asyncState);
+        
+        object EndGetData(System.IAsyncResult result);
+        
+        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetCollectionData", ReplyAction="http://mynamespace/IService1/GetCollectionDataResponse")]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference1.DataType1))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference1.DataType2))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.Generic.IEnumerable<object>))]
+        System.IAsyncResult BeginGetCollectionData(System.AsyncCallback callback, object asyncState);
+        
+        System.Collections.Generic.IEnumerable<object> EndGetCollectionData(System.IAsyncResult result);
+        
+        [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetNestedData", ReplyAction="http://mynamespace/IService1/GetNestedDataResponse")]
+        System.IAsyncResult BeginGetNestedData(System.AsyncCallback callback, object asyncState);
+        
+        WebServiceMoonlightTest.ServiceReference1.DataType2 EndGetNestedData(System.IAsyncResult result);
+    }
+    
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+    public interface IService1Channel : WebServiceMoonlightTest.ServiceReference1.IService1, System.ServiceModel.IClientChannel {
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+    public partial class GetDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+        
+        private object[] results;
+        
+        public GetDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
+                base(exception, cancelled, userState) {
+            this.results = results;
+        }
+        
+        public object Result {
+            get {
+                base.RaiseExceptionIfNecessary();
+                return ((object)(this.results[0]));
+            }
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+    public partial class GetCollectionDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+        
+        private object[] results;
+        
+        public GetCollectionDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
+                base(exception, cancelled, userState) {
+            this.results = results;
+        }
+        
+        public System.Collections.Generic.IEnumerable<object> Result {
+            get {
+                base.RaiseExceptionIfNecessary();
+                return ((System.Collections.Generic.IEnumerable<object>)(this.results[0]));
+            }
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+    public partial class GetNestedDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+        
+        private object[] results;
+        
+        public GetNestedDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
+                base(exception, cancelled, userState) {
+            this.results = results;
+        }
+        
+        public WebServiceMoonlightTest.ServiceReference1.DataType2 Result {
+            get {
+                base.RaiseExceptionIfNecessary();
+                return ((WebServiceMoonlightTest.ServiceReference1.DataType2)(this.results[0]));
+            }
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+    public partial class Service1Client : System.ServiceModel.ClientBase<WebServiceMoonlightTest.ServiceReference1.IService1>, WebServiceMoonlightTest.ServiceReference1.IService1 {
+        
+        private BeginOperationDelegate onBeginGetDataDelegate;
+        
+        private EndOperationDelegate onEndGetDataDelegate;
+        
+        private System.Threading.SendOrPostCallback onGetDataCompletedDelegate;
+        
+        private BeginOperationDelegate onBeginGetCollectionDataDelegate;
+        
+        private EndOperationDelegate onEndGetCollectionDataDelegate;
+        
+        private System.Threading.SendOrPostCallback onGetCollectionDataCompletedDelegate;
+        
+        private BeginOperationDelegate onBeginGetNestedDataDelegate;
+        
+        private EndOperationDelegate onEndGetNestedDataDelegate;
+        
+        private System.Threading.SendOrPostCallback onGetNestedDataCompletedDelegate;
+        
+        private BeginOperationDelegate onBeginOpenDelegate;
+        
+        private EndOperationDelegate onEndOpenDelegate;
+        
+        private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
+        
+        private BeginOperationDelegate onBeginCloseDelegate;
+        
+        private EndOperationDelegate onEndCloseDelegate;
+        
+        private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
+        
+        public Service1Client() {
+        }
+        
+        public Service1Client(string endpointConfigurationName) : 
+                base(endpointConfigurationName) {
+        }
+        
+        public Service1Client(string endpointConfigurationName, string remoteAddress) : 
+                base(endpointConfigurationName, remoteAddress) {
+        }
+        
+        public Service1Client(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
+                base(endpointConfigurationName, remoteAddress) {
+        }
+        
+        public Service1Client(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
+                base(binding, remoteAddress) {
+        }
+        
+/*
+        public System.Net.CookieContainer CookieContainer {
+            get {
+                System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
+                if ((httpCookieContainerManager != null)) {
+                    return httpCookieContainerManager.CookieContainer;
+                }
+                else {
+                    return null;
+                }
+            }
+            set {
+                System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
+                if ((httpCookieContainerManager != null)) {
+                    httpCookieContainerManager.CookieContainer = value;
+                }
+                else {
+                    throw new System.InvalidOperationException("Unable to set the CookieContainer. Please make sure the binding contains an HttpC" +
+                            "ookieContainerBindingElement.");
+                }
+            }
+        }
+*/
+        
+        public event System.EventHandler<GetDataCompletedEventArgs> GetDataCompleted;
+        
+        public event System.EventHandler<GetCollectionDataCompletedEventArgs> GetCollectionDataCompleted;
+        
+        public event System.EventHandler<GetNestedDataCompletedEventArgs> GetNestedDataCompleted;
+        
+        public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> OpenCompleted;
+        
+        public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> CloseCompleted;
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        System.IAsyncResult WebServiceMoonlightTest.ServiceReference1.IService1.BeginGetData(System.AsyncCallback callback, object asyncState) {
+            return base.Channel.BeginGetData(callback, asyncState);
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        object WebServiceMoonlightTest.ServiceReference1.IService1.EndGetData(System.IAsyncResult result) {
+            return base.Channel.EndGetData(result);
+        }
+        
+        private System.IAsyncResult OnBeginGetData(object[] inValues, System.AsyncCallback callback, object asyncState) {
+            return ((WebServiceMoonlightTest.ServiceReference1.IService1)(this)).BeginGetData(callback, asyncState);
+        }
+        
+        private object[] OnEndGetData(System.IAsyncResult result) {
+            object retVal = ((WebServiceMoonlightTest.ServiceReference1.IService1)(this)).EndGetData(result);
+            return new object[] {
+                    retVal};
+        }
+        
+        private void OnGetDataCompleted(object state) {
+            if ((this.GetDataCompleted != null)) {
+                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
+                this.GetDataCompleted(this, new GetDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
+            }
+        }
+        
+        public void GetDataAsync() {
+            this.GetDataAsync(null);
+        }
+        
+        public void GetDataAsync(object userState) {
+            if ((this.onBeginGetDataDelegate == null)) {
+                this.onBeginGetDataDelegate = new BeginOperationDelegate(this.OnBeginGetData);
+            }
+            if ((this.onEndGetDataDelegate == null)) {
+                this.onEndGetDataDelegate = new EndOperationDelegate(this.OnEndGetData);
+            }
+            if ((this.onGetDataCompletedDelegate == null)) {
+                this.onGetDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetDataCompleted);
+            }
+            base.InvokeAsync(this.onBeginGetDataDelegate, null, this.onEndGetDataDelegate, this.onGetDataCompletedDelegate, userState);
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        System.IAsyncResult WebServiceMoonlightTest.ServiceReference1.IService1.BeginGetCollectionData(System.AsyncCallback callback, object asyncState) {
+            return base.Channel.BeginGetCollectionData(callback, asyncState);
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        System.Collections.Generic.IEnumerable<object> WebServiceMoonlightTest.ServiceReference1.IService1.EndGetCollectionData(System.IAsyncResult result) {
+            return base.Channel.EndGetCollectionData(result);
+        }
+        
+        private System.IAsyncResult OnBeginGetCollectionData(object[] inValues, System.AsyncCallback callback, object asyncState) {
+            return ((WebServiceMoonlightTest.ServiceReference1.IService1)(this)).BeginGetCollectionData(callback, asyncState);
+        }
+        
+        private object[] OnEndGetCollectionData(System.IAsyncResult result) {
+            System.Collections.Generic.IEnumerable<object> retVal = ((WebServiceMoonlightTest.ServiceReference1.IService1)(this)).EndGetCollectionData(result);
+            return new object[] {
+                    retVal};
+        }
+        
+        private void OnGetCollectionDataCompleted(object state) {
+            if ((this.GetCollectionDataCompleted != null)) {
+                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
+                this.GetCollectionDataCompleted(this, new GetCollectionDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
+            }
+        }
+        
+        public void GetCollectionDataAsync() {
+            this.GetCollectionDataAsync(null);
+        }
+        
+        public void GetCollectionDataAsync(object userState) {
+            if ((this.onBeginGetCollectionDataDelegate == null)) {
+                this.onBeginGetCollectionDataDelegate = new BeginOperationDelegate(this.OnBeginGetCollectionData);
+            }
+            if ((this.onEndGetCollectionDataDelegate == null)) {
+                this.onEndGetCollectionDataDelegate = new EndOperationDelegate(this.OnEndGetCollectionData);
+            }
+            if ((this.onGetCollectionDataCompletedDelegate == null)) {
+                this.onGetCollectionDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetCollectionDataCompleted);
+            }
+            base.InvokeAsync(this.onBeginGetCollectionDataDelegate, null, this.onEndGetCollectionDataDelegate, this.onGetCollectionDataCompletedDelegate, userState);
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        System.IAsyncResult WebServiceMoonlightTest.ServiceReference1.IService1.BeginGetNestedData(System.AsyncCallback callback, object asyncState) {
+            return base.Channel.BeginGetNestedData(callback, asyncState);
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        WebServiceMoonlightTest.ServiceReference1.DataType2 WebServiceMoonlightTest.ServiceReference1.IService1.EndGetNestedData(System.IAsyncResult result) {
+            return base.Channel.EndGetNestedData(result);
+        }
+        
+        private System.IAsyncResult OnBeginGetNestedData(object[] inValues, System.AsyncCallback callback, object asyncState) {
+            return ((WebServiceMoonlightTest.ServiceReference1.IService1)(this)).BeginGetNestedData(callback, asyncState);
+        }
+        
+        private object[] OnEndGetNestedData(System.IAsyncResult result) {
+            WebServiceMoonlightTest.ServiceReference1.DataType2 retVal = ((WebServiceMoonlightTest.ServiceReference1.IService1)(this)).EndGetNestedData(result);
+            return new object[] {
+                    retVal};
+        }
+        
+        private void OnGetNestedDataCompleted(object state) {
+            if ((this.GetNestedDataCompleted != null)) {
+                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
+                this.GetNestedDataCompleted(this, new GetNestedDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
+            }
+        }
+        
+        public void GetNestedDataAsync() {
+            this.GetNestedDataAsync(null);
+        }
+        
+        public void GetNestedDataAsync(object userState) {
+            if ((this.onBeginGetNestedDataDelegate == null)) {
+                this.onBeginGetNestedDataDelegate = new BeginOperationDelegate(this.OnBeginGetNestedData);
+            }
+            if ((this.onEndGetNestedDataDelegate == null)) {
+                this.onEndGetNestedDataDelegate = new EndOperationDelegate(this.OnEndGetNestedData);
+            }
+            if ((this.onGetNestedDataCompletedDelegate == null)) {
+                this.onGetNestedDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetNestedDataCompleted);
+            }
+            base.InvokeAsync(this.onBeginGetNestedDataDelegate, null, this.onEndGetNestedDataDelegate, this.onGetNestedDataCompletedDelegate, userState);
+        }
+        
+        private System.IAsyncResult OnBeginOpen(object[] inValues, System.AsyncCallback callback, object asyncState) {
+            return ((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(callback, asyncState);
+        }
+        
+        private object[] OnEndOpen(System.IAsyncResult result) {
+            ((System.ServiceModel.ICommunicationObject)(this)).EndOpen(result);
+            return null;
+        }
+        
+        private void OnOpenCompleted(object state) {
+            if ((this.OpenCompleted != null)) {
+                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
+                this.OpenCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
+            }
+        }
+        
+        public void OpenAsync() {
+            this.OpenAsync(null);
+        }
+        
+        public void OpenAsync(object userState) {
+            if ((this.onBeginOpenDelegate == null)) {
+                this.onBeginOpenDelegate = new BeginOperationDelegate(this.OnBeginOpen);
+            }
+            if ((this.onEndOpenDelegate == null)) {
+                this.onEndOpenDelegate = new EndOperationDelegate(this.OnEndOpen);
+            }
+            if ((this.onOpenCompletedDelegate == null)) {
+                this.onOpenCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnOpenCompleted);
+            }
+            base.InvokeAsync(this.onBeginOpenDelegate, null, this.onEndOpenDelegate, this.onOpenCompletedDelegate, userState);
+        }
+        
+        private System.IAsyncResult OnBeginClose(object[] inValues, System.AsyncCallback callback, object asyncState) {
+            return ((System.ServiceModel.ICommunicationObject)(this)).BeginClose(callback, asyncState);
+        }
+        
+        private object[] OnEndClose(System.IAsyncResult result) {
+            ((System.ServiceModel.ICommunicationObject)(this)).EndClose(result);
+            return null;
+        }
+        
+        private void OnCloseCompleted(object state) {
+            if ((this.CloseCompleted != null)) {
+                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
+                this.CloseCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
+            }
+        }
+        
+        public void CloseAsync() {
+            this.CloseAsync(null);
+        }
+        
+        public void CloseAsync(object userState) {
+            if ((this.onBeginCloseDelegate == null)) {
+                this.onBeginCloseDelegate = new BeginOperationDelegate(this.OnBeginClose);
+            }
+            if ((this.onEndCloseDelegate == null)) {
+                this.onEndCloseDelegate = new EndOperationDelegate(this.OnEndClose);
+            }
+            if ((this.onCloseCompletedDelegate == null)) {
+                this.onCloseCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnCloseCompleted);
+            }
+            base.InvokeAsync(this.onBeginCloseDelegate, null, this.onEndCloseDelegate, this.onCloseCompletedDelegate, userState);
+        }
+        
+/*
+        protected override WebServiceMoonlightTest.ServiceReference1.IService1 CreateChannel() {
+            return new Service1ClientChannel(this);
+        }
+        
+        private class Service1ClientChannel : ChannelBase<WebServiceMoonlightTest.ServiceReference1.IService1>, WebServiceMoonlightTest.ServiceReference1.IService1 {
+            
+            public Service1ClientChannel(System.ServiceModel.ClientBase<WebServiceMoonlightTest.ServiceReference1.IService1> client) : 
+                    base(client) {
+            }
+            
+            public System.IAsyncResult BeginGetData(System.AsyncCallback callback, object asyncState) {
+                object[] _args = new object[0];
+                System.IAsyncResult _result = base.BeginInvoke("GetData", _args, callback, asyncState);
+                return _result;
+            }
+            
+            public object EndGetData(System.IAsyncResult result) {
+                object[] _args = new object[0];
+                object _result = ((object)(base.EndInvoke("GetData", _args, result)));
+                return _result;
+            }
+            
+            public System.IAsyncResult BeginGetCollectionData(System.AsyncCallback callback, object asyncState) {
+                object[] _args = new object[0];
+                System.IAsyncResult _result = base.BeginInvoke("GetCollectionData", _args, callback, asyncState);
+                return _result;
+            }
+            
+            public System.Collections.Generic.IEnumerable<object> EndGetCollectionData(System.IAsyncResult result) {
+                object[] _args = new object[0];
+                System.Collections.Generic.IEnumerable<object> _result = ((System.Collections.Generic.IEnumerable<object>)(base.EndInvoke("GetCollectionData", _args, result)));
+                return _result;
+            }
+            
+            public System.IAsyncResult BeginGetNestedData(System.AsyncCallback callback, object asyncState) {
+                object[] _args = new object[0];
+                System.IAsyncResult _result = base.BeginInvoke("GetNestedData", _args, callback, asyncState);
+                return _result;
+            }
+            
+            public WebServiceMoonlightTest.ServiceReference1.DataType2 EndGetNestedData(System.IAsyncResult result) {
+                object[] _args = new object[0];
+                WebServiceMoonlightTest.ServiceReference1.DataType2 _result = ((WebServiceMoonlightTest.ServiceReference1.DataType2)(base.EndInvoke("GetNestedData", _args, result)));
+                return _result;
+            }
+        }
+*/
+    }
+}
+