While generating proxy classes by SVCUTIL you may get following error:
"error CS0102: The type 'ConsoleApplication1.ServiceReference1.SomeType already contains a definition for 'SomePropety'."
Problem Description
This error occurs, because NETSVCUTIL has created a type SomeType twice. If you open generated classes in references.cs you will see that following code exists twice (with few differences).
public partial class SomeType : object, System.Runtime.Serialization.IExtensibleDataObject,
System.ComponentModel.INotifyPropertyChanged
{
[System.NonSerializedAttribute()]
private System.Runtime.Serialization.ExtensionDataObject someProperty;
[System.Runtime.Serialization.OptionalFieldAttribute()]
private string SomeProperty;
}
Mostly I get this error when the contract has been generated by ServiceFactory modeling edition. For example following model shows property named "Credentials", which is of type DataContract type SomeType.
If you click now on the shape LogInReq in the right bottom corner there is a property grid, which describes request properties.
If the request message (LogInReq shape) has one property only, the property "Is Wrapped" is by default set on FALSE. When this proeprty is set on on FALSE, you will get the error described above.
Solution
To solve a problem set property "Is Wrapped" on TRUE as shown at the picture above.
Posted
Aug 24 2008, 04:30 PM
by
Damir Dobric