SvcUtil error CS0102 and Service Modeling

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

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.

image

If you click now on the shape LogInReq in the right bottom corner there is a property grid, which describes request properties.
image
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
Filed under:

Comments

on 02-03-2009 22:04

Agile/Software Development/ALT.NET The Art of Agile Development: Collective Code Ownership Raymond provides an entry into lean methodologies Jeffery was on the Software Quality Isn't Optional panel and the video is available The StyleCop team announced

Rui Alves wrote re: SvcUtil error CS0102 and Service Modeling
on 12-14-2010 14:57

This helped me! Even if it has only one argument the request message must have the iswrapped set to true...

Many thanks!

developers.de is a .Net Community Blog powered by daenet GmbH.