SGEN: The top XML element from namespace references distinct types

I have the following classes (all defined in the same namespace, Test.NamespaceTest):

[XmlRootAttribute("rootTag")]
public class BaseClass
{
}


[XmlRootAttribute("rootTag")]
public class MyClass : BaseClass
{
}

and similarly

[XmlRootAttribute("rootTag")]
public class Class1
{
}


[XmlRootAttribute("rootTag")]
public class Class2
{
}

When sgen tries to create the serialization assemblies for these classes, I get the following error (same thing for BaseClass and MyClass):

The top XML element 'rootTag' from namespace " references distinct types Test.NamespaceTest.Class1 and Test.NamespaceTest.Class2. Use XML attributes to specify another XML name or namespace for the element or types.

Now, these classes should use the same root name so I defined the XmlRootAttribute. What do I need to do in order to get sgen to work? These classes are serialized and sent to existing services as SOAP requests so if I add namespace values, couldn't that mess up the service when it tries to deserialize the request, since no namespaces are originally defined?

Answers


This was resolved after adding some namespace attributes.


Need Your Help

Receiving Corrupted Info From Server

nsstring nsdate corrupt nsmutableurlrequest

On Iphone as well as android I am getting response codes of 200 meaning that I am getting a valid and good response with no errors, but the json that I am receiving has additional characters. I pri...

C# generics: any way to refer to the generic parameter types as a collection?

c# .net generics

I need to write a bunch of methods that take 1..N generic type parameters, eg:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.