<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.microsoft.co.il/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Gil Fink&amp;#39;s Blog : Miscellaneous, ASP.NET, Tips &amp; Tricks</title><link>http://blogs.microsoft.co.il/blogs/gilf/archive/tags/Miscellaneous/ASP.NET/Tips+_2600_+Tricks/default.aspx</link><description>Tags: Miscellaneous, ASP.NET, Tips &amp; Tricks</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>Error CS0029: Cannot implicitly convert type Using WSDL Tool</title><link>http://blogs.microsoft.co.il/blogs/gilf/archive/2010/02/01/error-cs0029-cannot-implicitly-convert-type-using-wsdl-tool.aspx</link><pubDate>Mon, 01 Feb 2010 17:11:02 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:512913</guid><dc:creator>Gil Fink</dc:creator><slash:comments>4</slash:comments><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/gilf/commentapi.aspx?PostID=512913</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/gilf/archive/2010/02/01/error-cs0029-cannot-implicitly-convert-type-using-wsdl-tool.aspx#comments</comments><description>&lt;h1&gt;&lt;strong&gt;Error CS0029: Cannot implicitly convert type Using WSDL Tool&lt;/strong&gt;&lt;/h1&gt;  &lt;p&gt;Today I was&lt;a href="http://blogs.microsoft.co.il/blogs/gilf/.NetLogowithASP.NET_07180596.jpg"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;margin-left:0px;border-top:0px;margin-right:0px;border-right:0px;" title="Error CS0029: Cannot implicitly convert type Using WSDL Tool" border="0" alt="Error CS0029: Cannot implicitly convert type Using WSDL Tool" align="right" src="http://blogs.microsoft.co.il/blogs/gilf/.NetLogowithASP.NET_thumb_36697B20.jpg" width="376" height="72" /&gt;&lt;/a&gt;    &lt;br /&gt; asked by one    &lt;br /&gt;of developers    &lt;br /&gt;I work with to    &lt;br /&gt;check an error    &lt;br /&gt;he got after he    &lt;br /&gt;generated a proxy class with the &lt;strong&gt;wsdl.exe&lt;/strong&gt; tool from a third party    &lt;br /&gt;&lt;strong&gt;wsdl&lt;/strong&gt; he got. The error was generated in runtime when he tried to use    &lt;br /&gt; the generated class and it was something like:&lt;/p&gt;  &lt;div style="border-bottom:gray 1px solid;border-left:gray 1px solid;padding-bottom:4px;line-height:12pt;background-color:#f4f4f4;margin:20px 0px 10px;padding-left:4px;width:97.5%;padding-right:4px;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;padding-top:4px;"&gt;   &lt;div style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;     &lt;pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;Unable to generate a temporary class (result=1).&lt;/pre&gt;

    &lt;pre style="border-bottom-style:none;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;error CS0029: Cannot implicitly convert type &lt;span style="color:#006080;"&gt;&amp;#39;A&amp;#39;&lt;/span&gt; to &lt;span style="color:#006080;"&gt;&amp;#39;A[]&amp;#39;&lt;/span&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;After searching in the internet I found that there is a known bug
  &lt;br /&gt;where the &lt;strong&gt;xsd&lt;/strong&gt;/&lt;strong&gt;wsdl&lt;/strong&gt; generators don’t produce the correct proxy

  &lt;br /&gt; class. The problem was that the generated class was produced with 

  &lt;br /&gt;a method call that return a jagged array ([][]) instead of a simple array 

  &lt;br /&gt;of type A ([]). In runtime the serialization of an array doesn’t 

  &lt;br /&gt;produce a jagged array and also the opposite and therefore it generate 

  &lt;br /&gt;the exception only in runtime.&lt;/p&gt;

&lt;h3&gt;&lt;strong&gt;How to fix the Problem?&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;After generating the &lt;strong&gt;C#&lt;/strong&gt; proxy class from the given &lt;strong&gt;wsdl&lt;/strong&gt; check that

  &lt;br /&gt; the generated class is correct and if not manually fix all the 

  &lt;br /&gt;problems. The fix for our problem was to remove one of the two []

  &lt;br /&gt;from the jagged array that was generated. 

  &lt;br /&gt;

  &lt;br /&gt;I hope it will help you if you stumble on this error in the future.&lt;/p&gt;&lt;div class="wlWriterHeaderFooter" style="text-align:left;margin:0px;padding:4px 4px 4px 4px;"&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://blogs.microsoft.co.il/blogs/gilf/archive/2010/02/01/error-cs0029-cannot-implicitly-convert-type-using-wsdl-tool.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://blogs.microsoft.co.il/blogs/gilf/archive/2010/02/01/error-cs0029-cannot-implicitly-convert-type-using-wsdl-tool.aspx&amp;amp;bgcolor=0080C0&amp;amp;fgcolor=FFFFFF&amp;amp;border=000000&amp;amp;cbgcolor=D4E1ED&amp;amp;cfgcolor=000000" alt="DotNetKicks Image" border="0/" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=512913" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/gilf/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.microsoft.co.il/blogs/gilf/archive/tags/Miscellaneous/default.aspx">Miscellaneous</category><category domain="http://blogs.microsoft.co.il/blogs/gilf/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.microsoft.co.il/blogs/gilf/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/gilf/archive/tags/Tips+_2600_+Tricks/default.aspx">Tips &amp; Tricks</category></item></channel></rss>