Error CS0029: Cannot implicitly convert type Using WSDL Tool

February 1, 2010


Error CS0029: Cannot implicitly convert type Using WSDL Tool

Today I wasError CS0029: Cannot implicitly convert type Using WSDL Tool
asked by one
of developers
I work with to
check an error
he got after he
generated a proxy class with the wsdl.exe tool from a third party
wsdl he got. The error was generated in runtime when he tried to use
the generated class and it was something like:

Unable to generate a temporary class (result=1).
error CS0029: Cannot implicitly convert type 'A' to 'A[]'

After searching in the internet I found that there is a known bug

where the xsd/wsdl generators don’t produce the correct proxy

class. The problem was that the generated class was produced with

a method call that return a jagged array ([][]) instead of a simple array

of type A ([]). In runtime the serialization of an array doesn’t

produce a jagged array and also the opposite and therefore it generate

the exception only in runtime.

How to fix the Problem?

After generating the C# proxy class from the given wsdl check that

the generated class is correct and if not manually fix all the

problems. The fix for our problem was to remove one of the two []

from the jagged array that was generated.

I hope it will help you if you stumble on this error in the future.

DotNetKicks Image
Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



  1. Yaron NavehFebruary 27, 2010 ב 16:17

    I’ve given another analysis of this issue in this post:

    Seems like there is another way to fix it which will not break in case of “update service reference”.

  2. Gil FinkFebruary 27, 2010 ב 17:24

    Hi Yaron Naveh,
    I read your post which includes good explanation.
    In my situation it’s a third party java service which we can’t change it’s wsdl.

  3. Yaron NavehFebruary 28, 2010 ב 9:42

    Hi Gil

    You can save the wsdl locally and change it b4 you add reference. This would also break when the wsdl changes but it might be easier to automate.