BUG: “Cannot implicitly convert type ‘System.Data.DataSet’” error when application is built
Symptoms
You have a Web Service that has a Web Service method that returns an instance of a custom class. The class that is returned by the Web Service method implements the IXmlSerializable interface. If you use this Web Service in an application, you may receive the following error message when you build the application:
Cannot implicitly convert type ‘System.Data.DataSet’ to ‘ClassLibrary.ClassName’
Resolution
When you add a Web reference to a Web Service, Microsoft Visual Studio .NET incorrectly uses System.Data.DataSet instead of the class that implements the IXmlSerializable interface. Therefore, the Web Service method in the proxy class returns System.Data.DataSet instead of the custom class that implements the IXmlSerializable interface. Therefore, you receive the error message when you consume the Web Service method in your Web application.

Leave a Reply