Recently I faced a problem while accessing a webservice, I added web reference in my Visual Studio project, and created an instance of a class, and it returned me error which was something like :
Unable to generate a temporary class (result=1).
error CS0029: Cannot implicitly convert type 'SomeType' to 'SomeType'
-SomeType = any class name available in the Service being consumed
After some efforts and googling, I found that this is one of the known bugs of .NET. This problem was due to a type which was structured / mapped as dynamic array, like SomeType. and the consumer of such properties data type was expecting a simple SomeType Object.
What I did, I created a local class strucutre for the WSDL file and added that file in my project. To create a code file / class for the WSDL file , you need to follow these steps:
1. Start Command Prompt of Visual Studio ( try to run as administrator)
2. Type following command :
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>wsdl /o:d:\\referencefile
3. It will create the dot cs file at the location specified in the above command, copy the file and add it in your project.
4.Remove the web reference from the project.
5.From the CS file genereated find / search for double square brackets "" for SomeType / Class name for which exception is being thrown, and change it to single square pair "". Save and compile.
Now it must now throw exeception. Hope that helps some one. ;-)