[Mono-bugs] [Bug 78611][Nor] New - Exception at SoapHttpClientProtocol constructor (in MS.NET it works)

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Jun 14 08:21:20 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by lluis at ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=78611

--- shadow/78611	2006-06-14 08:21:20.000000000 -0400
+++ shadow/78611.tmp.5350	2006-06-14 08:21:20.000000000 -0400
@@ -0,0 +1,278 @@
+Bug#: 78611
+Product: Mono: Class Libraries
+Version: unspecified
+OS: unknown
+OS Details: Windows XP SP2
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: Sys.XML
+AssignedTo: lluis at ximian.com                            
+ReportedBy: knocte at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Exception at SoapHttpClientProtocol constructor (in MS.NET it works)
+
+I have a very simple C# project created with VS2005 that only contains a
+web reference to a web service that I am developing.
+
+If I make a very simple testcase using a console application that only
+creates an instance of the main class of this project, .NET runs it without
+problems but Mono throws the following exception:
+
+C:\Apl\IRM4\src\Client\Tests\Debug
+Tests\TestConsoleLauncher\bin\Debug>"C:\Archivos de
+programa\Mono-1.1.15\bin\mono.exe" TestConsoleLauncher.exe
+
+Unhandled Exception: System.InvalidOperationException: IsNullable may not
+be 'true' for value type System.Nullable`1[[System.Int32, mscorlib,
+Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] in
+member 'updateId' in <0x00621> 
+System.Xml.Serialization.XmlReflectionImporter:ImportElementInfo
+(System.Type cls, System.String defaultName, System.String
+defaultNamespace, System.Type defaultType,
+System.Xml.Serialization.XmlTypeMapMemberElement member, Sys
+tem.Xml.Serialization.XmlAttributes atts)
+in <0x00a95> System.Xml.Serialization.XmlReflectionImporter:CreateMapMember
+(System.Type declaringType, System.Xml.Serialization.XmlReflectionMember
+rmember, System.String defaultNamespace)
+in <0x00069>
+System.Xml.Serialization.XmlReflectionImporter:ImportMembersMapping
+ (System.String elementName, System.String ns,
+System.Xml.Serialization.XmlRefle
+ctionMember[] members, Boolean hasWrapperElement)
+in <0x0063b> System.Web.Services.Protocols.SoapMethodStubInfo:.ctor
+(System.Web.Services.Protocols.TypeStubInfo typeStub,
+System.Web.Services.Protocols.LogicalMethodInfo source, System.Object kind,
+System.Xml.Serialization.XmlReflectionImporter xmlImporter,
+System.Xml.Serialization.SoapReflectionImporter soapImporter)
+in <0x000c0>
+System.Web.Services.Protocols.SoapTypeStubInfo:CreateMethodStubInfo
+ (System.Web.Services.Protocols.TypeStubInfo parent,
+System.Web.Services.Protocols.LogicalMethodInfo lmi, Boolean isClientProxy)
+in <0x000f7> System.Web.Services.Protocols.TypeStubInfo:BuildTypeMethods ()
+in <0x00012> System.Web.Services.Protocols.TypeStubInfo:Initialize ()
+in <0x00065>
+System.Web.Services.Protocols.LogicalTypeInfo:CreateTypeStubInfo
+(System.Type type)
+in <0x00056> System.Web.Services.Protocols.LogicalTypeInfo:GetTypeStub
+(System.String protocolName)
+in <0x0001b> System.Web.Services.Protocols.TypeStubManager:GetTypeStub
+(System.Type t, System.String protocolName)
+in <0x00023> System.Web.Services.Protocols.SoapHttpClientProtocol:.ctor ()
+in <0x00013> WebServiceReferences.IRM_WebServer.IRM_WS:.ctor ()
+in (wrapper remoting-invoke-with-check)
+WebServiceReferences.IRM_WebServer.IRM_WS:.ctor ()
+in <0x00022> TestConsoleLauncher.Program:Main (System.String[] args)
+
+
+The small testcase console project only contains the following code:
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using System.IO;
+
+namespace TestConsoleLauncher
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            WebServiceReferences.IRM_WebServer.IRM_WS oWebServer =
+              new WebServiceReferences.IRM_WebServer.IRM_WS();
+        }
+    }
+}
+
+The references of the project are:
+System
+System.Data
+System.Web.Services
+WebServiceReferences (this is the assembly that I have mentioned that only
+contains a web reference to a webservice).
+
+If you need the DLL of the WebServiceReferences assembly, I will see if I
+can post it here.
+
+------- Additional Comments From knocte at gmail.com  2006-06-08 08:06 -------
+Changing priority to Normal.
+
+It seems a bug in System.Xml so reassigning Component.
+
+The exception is telling something about a field called updateId, so
+here is a code snippet from the References.cs file that contains all
+the references to this parameter:
+
+
+
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:2.0.50727.42
+//
+//     Changes to this file may cause incorrect behavior and will be
+lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+// 
+// This source code was auto-generated by Microsoft.VSDesigner,
+Version 2.0.50727.42.
+// 
+#pragma warning disable 1591
+
+namespace WebServiceReferences.IRM_WebServer {
+    using System.Diagnostics;
+    using System.Web.Services;
+    using System.ComponentModel;
+    using System.Web.Services.Protocols;
+    using System;
+    using System.Xml.Serialization;
+    
+    
+    /// <remarks/>
+   
+[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services",
+"2.0.50727.42")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Web.Services.WebServiceBindingAttribute(Name="IRM_WSSoap",
+Namespace="http://tempuri.org/")]
+    public partial class IRM_WS :
+System.Web.Services.Protocols.SoapHttpClientProtocol {
+        
+        private System.Threading.SendOrPostCallback
+ExistsClientOperationCompleted;
+        
+        private System.Threading.SendOrPostCallback
+GetTerminalOperationCompleted;
+
+
+
+(...)
+
+
+
+       
+[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/InsertUpdateEvent",
+RequestNamespace="http://tempuri.org/",
+ResponseNamespace="http://tempuri.org/",
+Use=System.Web.Services.Description.SoapBindingUse.Literal,
+ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+        public int InsertUpdateEvent(int idSeverity, EventUpdateCode
+idEvent, string applicationName, string messageDescription,
+[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
+System.Nullable<int> updateId, System.DateTime originatedDate, string
+guid) {
+            object[] results = this.Invoke("InsertUpdateEvent", new
+object[] {
+                        idSeverity,
+                        idEvent,
+                        applicationName,
+                        messageDescription,
+                        updateId,
+                        originatedDate,
+                        guid});
+            return ((int)(results[0]));
+        }
+        
+        /// <remarks/>
+        public void InsertUpdateEventAsync(int idSeverity,
+EventUpdateCode idEvent, string applicationName, string
+messageDescription, System.Nullable<int> updateId, System.DateTime
+originatedDate, string guid) {
+            this.InsertUpdateEventAsync(idSeverity, idEvent,
+applicationName, messageDescription, updateId, originatedDate, guid,
+null);
+        }
+        
+        /// <remarks/>
+        public void InsertUpdateEventAsync(int idSeverity,
+EventUpdateCode idEvent, string applicationName, string
+messageDescription, System.Nullable<int> updateId, System.DateTime
+originatedDate, string guid, object userState) {
+            if ((this.InsertUpdateEventOperationCompleted == null)) {
+                this.InsertUpdateEventOperationCompleted = new
+System.Threading.SendOrPostCallback(this.OnInsertUpdateEventOperationCompleted);
+            }
+            this.InvokeAsync("InsertUpdateEvent", new object[] {
+                        idSeverity,
+                        idEvent,
+                        applicationName,
+                        messageDescription,
+                        updateId,
+                        originatedDate,
+                        guid},
+this.InsertUpdateEventOperationCompleted, userState);
+        }
+
+
+
+(...)
+
+
+
+------- Additional Comments From knocte at gmail.com  2006-06-09 04:55 -------
+The problem is here:
+
+http://svn.myrealbox.com/viewcvs/trunk/mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs?view=markup
+
+if (elem.IsNullable && elem.TypeData.IsValueType)
+    throw new InvalidOperationException ("IsNullable may not be 'true'
+for value type " + elem.TypeData.FullTypeName + " in member '" +
+defaultName + "'");
+
+
+------- Additional Comments From knocte at gmail.com  2006-06-09 05:41 -------
+Original condition:
+
+if (elem.IsNullable && elem.TypeData.IsValueType)
+
+New one:
+
+if (elem.IsNullable &&
+    (!elem.TypeData.FullTypeName.ToString().Contains("System.Nullable"))
+    && elem.TypeData.IsValueType)
+
+Would it be acceptable this change?
+
+If I am on the right direction, perhaps this patch is a little
+"hacky", I wonder if it can be done this way:
+
+(!elem.TypeData.Type is System.Nullable)
+
+Thanks in advance.
+
+------- Additional Comments From knocte at gmail.com  2006-06-09 06:54 -------
+Just wondering again... (have not tested it yet):
+
+if (elem.IsNullable && elem.TypeData.IsValueType){
+    boolean nullable = false;
+    foreach(Type interface in elem.TypeData.Type.GetInterfaces()){
+        if (interface is INullableValue){
+            nullable = true;
+            break;
+        }
+    }
+    if (!nullable){
+        throw new InvalidOperationException ("Type " +
+elem.TypeData.FullTypeName + " in member '" +
+defaultName + "' does not implement INullableValue");
+    }
+}
+
+
+And something like this??
+
+
+
+------- Additional Comments From lluis at ximian.com  2006-06-14 08:21 -------
+It's not just a matter of finding a workaround for the crash. If
+serialization of such type is allowed as nullable, it may need other
+changes in the serializer.


More information about the mono-bugs mailing list