cs0030:Unable to generate a temporary class
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 'Short开发者_JAVA百科Sell.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?
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
In my wdsl there was no "xs:sequence" element, so I couldn't apply wsdl file change directly. However, I fixed the issue by referencing below post.
https://stackoverflow.com/a/27507816/503446
精彩评论