After updating the Partner API to v32.0 from v31.0 I started getting the following SGEN compilation errors:
- System.InvalidOperationException: Unable to generate a temporary class (result=1).
- error CS0029: Cannot implicitly convert type 'XYZ.SalesforcePartner.ListViewRecordColumn' to 'XYZ.SalesforcePartner.ListViewRecordColumn[]'
The new ListViewRecord and ListViewRecordColumn complexTypes from the v32.0 wsdl:
<complexType name="ListViewRecord">
<sequence>
<element name="columns" type="tns:ListViewRecordColumn" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="ListViewRecordColumn">
<sequence>
<element name="fieldNameOrPath" type="xsd:string"/>
<element name="value" type="xsd:string" nillable="true"/>
</sequence>
</complexType>
The problem appears in the generated Reference.cs with the ExecuteListViewResult.records multidimensional array return type.
///
[System.Xml.Serialization.XmlArrayItemAttribute("columns", typeof(ListViewRecordColumn), IsNullable=false)]
public ListViewRecordColumn[][] records {
get {
return this.recordsField;
}
set {
this.recordsField = value;
}
}
The XmlArrayItemAttribute typeof(ListViewRecordColumn) should be typeof(ListViewRecordColumn[]). After changing this manually the web reference compiled again.
///
[System.Xml.Serialization.XmlArrayItemAttribute("columns", typeof(ListViewRecordColumn[]), IsNullable=false)]
public ListViewRecordColumn[][] records {
get {
return this.recordsField;
}
set {
this.recordsField = value;
}
}
See also:
- XSD.EXE - Incorrect Class Generated for Abstract Type With Derived Types
- xsd.exe generated classes causing "Unable to generate a temporary class" exception
- Importing the Salesforce Winter 13 Metadata API to .NET
- Knowledge Article Number: 000205824 "Unable to generate a temporary class (result=1)" is returned when .Net integration tries to parse the Enterprise WSDL version 32.0