filii_neo

Hi,

after calling a method of a webservice proxy, the following exception occured.

System.InvalidOperationException: InvalidOperationException
at System.Array.BinarySearch()
at System.Xml.Serialization.QNameContainer.doLookup()
at System.Xml.Serialization.QNameContainer.get_Item()
at System.Xml.Serialization.MemberValueCollection.doLookup()
at System.Xml.Serialization.XmlSerializationReader.doLookup()
at System.Xml.Serialization.XmlSerializationReader.DeserializeElementMember()
at System.Xml.Serialization.XmlSerializationReader.deserializeMembers()
at System.Xml.Serialization.XmlSerializationReader.DeserializeComplexElement()
at System.Xml.Serialization.XmlSerializationReader.deserializeElement()
at System.Xml.Serialization.XmlSerializationReader.deserializeLiteralArray()
at System.Xml.Serialization.XmlSerializationReader.DeserializeArrayLikeElement()
at System.Xml.Serialization.XmlSerializationReader.deserializeElement()
at System.Xml.Serialization.XmlSerializationReader.DeserializeElementMember()
at System.Xml.Serialization.XmlSerializationReader.deserializeMembers()
at System.Xml.Serialization.XmlSerializationReader.DeserializeComplexElement()
at System.Xml.Serialization.XmlSerializationReader.deserializeElement()
at System.Xml.Serialization.XmlSerializationReader.DeserializeElementMember()
at System.Xml.Serialization.XmlSerializationReader.deserializeMembers()
at System.Xml.Serialization.XmlSerializationReader.DeserializeComplexElement()
at System.Xml.Serialization.XmlSerializationReader.deserializeElement()
at System.Xml.Serialization.XmlSerializationReader.DeserializeElementMember()
at System.Xml.Serialization.XmlSerializationReader.deserializeMembers()
at System.Web.Services.Protocols.SoapMessageParser.execute()
at System.Web.Services.Protocols.SoapMessageSerializer.Deserialize()
at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke()

Why has this exception been thrown

thx

filii



Re: .NET Compact Framework InvalidOperationException after calling webservice

Guang-Ming Bian - MSFT

hi filii_neo

I feel that something wrong with Serialization
Please click the link below:
http://blogs.msdn.com/netcfteam/archive/2007/02/01/why-your-netcf-apps-fail-to-call-some-web-services.aspx

I hope it helpful to you






Re: .NET Compact Framework InvalidOperationException after calling webservice

filii_neo

Hi, thanks for you answer,

I have read the blog article and I was very surprised. I do not understand whether the exceptions will be thrown always. The exceptions I have posted do only appear seldom.That's the thing that is so confusing. Is my problem the same like in the blog post

So, right now, I can not ensure that a webservice call will return successfully. And this is really frustrating.

filii_neo





Re: .NET Compact Framework InvalidOperationException after calling webservice

Anthony Wong - MSFT

Hi,

The exception on serialization can be triggered by the data input you use for the web service call. If you can find the data input/data type of the web service call that reproduces the issue consistently it would help our investigation a lot.

Thanks,

Anthony Wong [MSFT]





Re: .NET Compact Framework InvalidOperationException after calling webservice

filii_neo

Hi Anthony,

Sorry, the problem can not be reproduced consistently. Sometimes, the excetpion will be thrown, but I have no idea under with circumstances.

But, I can provided the result datatype of the webservice call. Pherhaps, that can help you. The input parameter of the webmethod is a single string. And the response is the following:

Generated Proxy Data Classes

public partial class LogonResponse {
private Message[] messagesField;
private Task[] tasksField;

///
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
[System.Xml.Serialization.XmlArrayItemAttribute("messages", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public Message[] messages {
get { return this.messagesField; }
set { this.messagesField = value; }
}

///
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
[System.Xml.Serialization.XmlArrayItemAttribute("tasks", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public Task[] tasks {
get { return this.tasksField; }
set { this.tasksField = value; }
}
}

///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.foo.bar/TaskManager/typ" +
"es")]
public partial class Message {
private string contextField;
private System.Nullable createDateField;
private string createUserField;
private string idField;
private int priorityField;
private Property[] propertiesField;
private string subjectField;
private string[] teamsField;
private System.Nullable updateDateField;
private string updateUserField;
private string[] usersField;

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public string context {
get { return this.contextField; }
set { this.contextField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public System.Nullable createDate {
get { return this.createDateField; }
set { this.createDateField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public string createUser {
get { return this.createUserField; }
set { this.createUserField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public string id {
get { return this.idField; }
set { this.idField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public int priority {
get { return this.priorityField; }
set { this.priorityField = value; }
}

///
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
[System.Xml.Serialization.XmlArrayItemAttribute("properties", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public Property[] properties {
get { return this.propertiesField; }
set { this.propertiesField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public string subject {
get { return this.subjectField; }
set { this.subjectField = value; }
}

///
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
[System.Xml.Serialization.XmlArrayItemAttribute("content", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string[] teams {
get { return this.teamsField; }
set { this.teamsField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public System.Nullable updateDate {
get { return this.updateDateField; }
set { this.updateDateField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public string updateUser {
get { return this.updateUserField; }
set { this.updateUserField = value; }
}

///
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
[System.Xml.Serialization.XmlArrayItemAttribute("content", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string[] users {
get { return this.usersField; }
set { this.usersField = value; }
}
}

///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(http://www.foo.bar/TaskManager/TaskManager/typ" +
"es")]
public partial class Property {
private string nameField;
private string valueField;

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public string name {
get { return this.nameField; }
set { this.nameField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public string value {
get { return this.valueField; }
set { this.valueField = value; }
}
}

///
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.foo.bar/TaskManager/typ" +
"es")]
public partial class Task {
private string assignedUserField;
private string contextField;
private System.Nullable createDateField;
private string createUserField;
private string idField;
private int priorityField;
private Property[] propertiesField;
private string statusField;
private string subjectField;
private string[] teamsField;
private System.Nullable timeoutField;
private System.Nullable updateDateField;
private string updateUserField;
private string[] usersField;

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public string assignedUser {
get { return this.assignedUserField; }
set { this.assignedUserField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public string context {
get { return this.contextField; }
set { this.contextField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public System.Nullable createDate {
get { return this.createDateField; }
set { this.createDateField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public string createUser {
get { return this.createUserField; }
set { this.createUserField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public string id {
get { return this.idField; }
set { this.idField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public int priority {
get { return this.priorityField; }
set { this.priorityField = value; }
}

///
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
[System.Xml.Serialization.XmlArrayItemAttribute("properties", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public Property[] properties {
get { return this.propertiesField; }
set { this.propertiesField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public string status {
get { return this.statusField; }
set { this.statusField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public string subject {
get { return this.subjectField; }
set { this.subjectField = value; }
}

///
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
[System.Xml.Serialization.XmlArrayItemAttribute("content", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string[] teams {
get { return this.teamsField; }
set { this.teamsField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public System.Nullable timeout {
get { return this.timeoutField; }
set { this.timeoutField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public System.Nullable updateDate {
get { return this.updateDateField; }
set { this.updateDateField = value; }
}

///
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public string updateUser {
get { return this.updateUserField; }
set { this.updateUserField = value; }
}

///
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
[System.Xml.Serialization.XmlArrayItemAttribute("content", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string[] users {
get { return this.usersField; }
set { this.usersField = value; }
}
}

WSDL Data Definition
<complexType name="LogonResponse">
<sequence>
<element name="messages" nillable="true" type="tns:MessageArray"/>
<element name="tasks" nillable="true" type="tns:TaskArray"/></sequence></complexType>
<complexType name="MessageArray">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="messages" nillable="true" type="tns:Message"/></sequence></complexType>
<complexType name="Message">
<sequence>
<element name="context" nillable="true" type="string"/>
<element name="createDate" nillable="true" type="dateTime"/>
<element name="createUser" nillable="true" type="string"/>
<element name="id" nillable="true" type="string"/>
<element name="priority" type="int"/>
<element name="properties" nillable="true" type="tns:PropertyArray"/>
<element name="subject" nillable="true" type="string"/>
<element name="teams" nillable="true" type="tns:StringArray"/>
<element name="updateDate" nillable="true" type="dateTime"/>
<element name="updateUser" nillable="true" type="string"/>
<element name="users" nillable="true" type="tns:StringArray"/></sequence></complexType>
<complexType name="PropertyArray">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="properties" nillable="true" type="tns:Property"/></sequence></complexType>
<complexType name="Property">
<sequence>
<element name="name" nillable="true" type="string"/>
<element name="value" nillable="true" type="string"/></sequence></complexType>
<complexType name="StringArray">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="content" nillable="true" type="string"/></sequence></complexType>
<complexType name="TaskArray">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="tasks" nillable="true" type="tns:Task"/></sequence></complexType>
<complexType name="Task">
<sequence>
<element name="assignedUser" nillable="true" type="string"/>
<element name="context" nillable="true" type="string"/>
<element name="createDate" nillable="true" type="dateTime"/>
<element name="createUser" nillable="true" type="string"/>
<element name="id" nillable="true" type="string"/>
<element name="priority" type="int"/>
<element name="properties" nillable="true" type="tns:PropertyArray"/>
<element name="status" nillable="true" type="string"/>
<element name="subject" nillable="true" type="string"/>
<element name="teams" nillable="true" type="tns:StringArray"/>
<element name="timeout" nillable="true" type="dateTime"/>
<element name="updateDate" nillable="true" type="dateTime"/>
<element name="updateUser" nillable="true" type="string"/>
<element name="users" nillable="true" type="tns:StringArray"/>
</sequence>
</complexType>