Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cs0030:Unable to generate a temporary class

Tags:

c#

I have a Web Service, when I try to generate the object of it I am getting below error.

"Unable to generate a temporary class (result=1).error CS0030: Cannot convert type 'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment[]' to 'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment'error CS0030: Cannot convert type 'ShortSell.ShortSellRSOriginDestinationOptionFlightSegment[]' to 'ShortSell.ShortSellRSOriginDestinationOptionFlightSegment'error CS0030: Cannot convert type 'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment[]' to 'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment'error CS0029: Cannot implicitly convert type 'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment' to 'ShortSell.ShortSellRQOriginDestinationInformationFlightSegment[]'error CS0029: Cannot implicitly convert type 'ShortSell.ShortSellRSOriginDestinationOptionFlightSegment' to 'ShortSell.ShortSellRSOriginDestinationOptionFlightSegment[]'error CS0029: Cannot implicitly convert type 'ShortSell.ShortSellRSOriginDestinationOptionFlightSegment' to 'ShortSell.ShortSellRSOriginDestinationOptionFlightSegment[]'"}

I tried changing the temp folder properties to writable but I am still getting this error. Why am I getting this error and how can I fix it?

like image 877
Reaves Avatar asked Sep 28 '11 09:09

Reaves


1 Answers

It's a known bug that won't be fixed:

  • Microsoft Connect: XmlSerializer Code Generation component cannot handle nested unbounded elements when there is only one element

The error occurs when a complex type in the wsdl contains exactly one element with unbounded occurrence. The workaround, taken from this forum discussion (credit to Elena Kharitidi), is to add dummy attributes to such types:

<xs:sequence maxOccurs="unbounded">
  <xs:element ../>
<xs:sequence>
<xs:attribute name="tmp" type="xs:string" />      <-- add this

and

<xs:sequence>
  <xs:element maxOccurs="unbounded"/>
<xs:sequence>
<xs:attribute name="tmp" type="xs:string" />      <-- add this
like image 196
Heinzi Avatar answered Oct 09 '22 14:10

Heinzi