Link to home
Start Free TrialLog in
Avatar of SoCalKen99
SoCalKen99Flag for United States of America

asked on

After upgrading from VS2008 to VS2010, WCF proxy project won't build

I have a C# WCF proxy client project that uses a service reference.  This proxy is used by a C++/CLI app to communicate with a server app.  Everything built and worked fine with VS2008. After upgrading to VS2010, I'm getting build errors.  Here's the deal:

This is my service definition:
[ServiceContract(Name = "NavigatorAPDServiceContract",
                    Namespace = "http://www.radiusarm.com/NavigatorAPDServices/2009/03",
                    CallbackContract = typeof(INavigatorAPDServiceCallback),
                    SessionMode = SessionMode.Required)]
   public interface INavigatorAPDService
   {
   ...
   }

Open in new window


Here is the callback contract:
   public interface INavigatorAPDServiceCallback
   {
      [OperationContract(Name = "AVSStartup")]
      [FaultContract(typeof(ReceiverFaultDetail))]
      [FaultContract(typeof(SenderFaultDetail))]
      AVSControlMsgResult AVSStartup(OCAVSStartup requestMessage);
      ...
   }

Open in new window


I have a separate assembly with common types shared between clients and server, defined in namespace Radius.Navigator.CommonContentTypes.

The auto-generated service reference code from VS2008 for this method looks like this:
[System.ServiceModel.OperationContractAttribute (Action="http://www.radiusarm.com/NavigatorAPDServices/2009/03/NavigatorAPDServiceContract" + "/AVSStartup", ReplyAction="http://www.radiusarm.com/NavigatorAPDServices/2009/03/NavigatorAPDServiceContract" + "/AVSStartupResponse")]
--- fault contract info omitted for brevity ---
Radius.Navigator.CommonContentTypes.AVSControlMsgResult AVSStartup(Radius.Navigator.CommonContentTypes.OCAVSStartup requestMessage);

Open in new window


Note that the parameter type of the method is OCAVSStartup in namespace Radius.Navigator.CommonContentTypes.

The auto-generated service reference code from VS2010 for this method looks like this:
[System.ServiceModel.OperationContractAttribute(Action="http://www.radiusarm.com/NavigatorAPDServices/2009/03/NavigatorAPDServiceContract" + "/AVSStartup", ReplyAction="http://www.radiusarm.com/NavigatorAPDServices/2009/03/NavigatorAPDServiceContract" + "/AVSStartupResponse")]
--- fault contract info omitted for brevity ---
[System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(OCAVSMessageBase))]
Radius.Navigator.APDClient.NavigatorServiceReference.AVSStartupResponse AVSStartup(Radius.Navigator.APDClient.NavigatorServiceReference.AVSStartupSolicit request);

Open in new window


Note that the parameter type of the method is AVSStartupSolicit in namespace Radius.Navigator.APDClient.NavigatorServiceReference. Radius.Navigator.APDClient is the namespace of the proxy app & NavigatorServiceReference is the name of the service reference.

Here is the build error:
error CS0535: 'Radius.Navigator.APDClient.APDCallback' does not implement interface member 'Radius.Navigator.APDClient.NavigatorServiceReference.NavigatorAPDServiceContractCallback.AVSStartup(Radius.Navigator.APDClient.NavigatorServiceReference.AVSStartupSolicit)'

My question is this: why is VS2010 creating this new type (AVSStartupSolicit) & is there any way to force it to behave as VS2008 did (and generate code that uses the parameter type as defined in my callback contract)?  This interface has dozens of members and it is a large refactoring project to locate and change all usages of this interface.

Thanks for any insights you can provide, experts!
Avatar of Sathish DV
Sathish DV
Flag of United States of America image

Hi, Check ur type Radius.Navigator.CommonContentTypes datastructure has valid datacontract and datamember and also this type should be exposed to client by adding reference before generating proxy. Also can u post how u implemented INavigatorAPDServiceCallback in the service class?
Avatar of SoCalKen99

ASKER

sathishinfotech,

This code has been deployed and working for a couple years, built with VS2008.

This issue is entirely about differences in auto-generated service reference code between VS2008 and VS2010.  

   public class APDCallback : NavigatorAPDServiceContractCallback
   {
      #region Public Delegates and Events
      ///////////////////////////////////////////////////////////////////////////////
      /// <summary>
      ///   Delegate used for subscribing to events for messages received on this interface
      /// </summary>
      ///////////////////////////////////////////////////////////////////////////////
      public delegate AVSControlMsgResult AVSMessageAvailableEventHandler(Object sender, OCAVSMessageBase message);

      ///////////////////////////////////////////////////////////////////////////////
      /// <summary>
      ///   Event used for subscribing to events for messages received on this interface
      /// </summary>
      ///////////////////////////////////////////////////////////////////////////////
      public event AVSMessageAvailableEventHandler APDCallbackMessageAvailable;
      #endregion


      ///////////////////////////////////////////////////////////////////////////////
      /// <summary>
      ///   Notifies subscribers that a message has been received on this interface
      /// </summary>
      ///////////////////////////////////////////////////////////////////////////////
      public AVSControlMsgResult OnAPDCallbackMessageAvailable(Object sender, OCAVSMessageBase message)
      {
         if (APDCallbackMessageAvailable != null)
            return APDCallbackMessageAvailable(sender, message);
         return AVSControlMsgResult.APDNotStarted;
      }

      ///////////////////////////////////////////////////////////////////////////////
      public AVSControlMsgResult AVSStartup(OCAVSStartup requestMessage)
      {
         requestMessage.OperationType = OCAVSOperationTypes.AVSStartup;
         return OnAPDCallbackMessageAvailable(this, requestMessage);
      }

...
}

Open in new window

Here is the definition of the OCAVSStartup class:

namespace Radius.Navigator.CommonContentTypes
{
   [DataContract(Namespace = "http://schemas.radiusarm.com/NavigatorServices/2009/03")]
   public class OCAVSStartup : OCAVSMessageBase
   {
      public OCAVSStartup()
         : base(OCAVSOperationTypes.AVSStartup)
      {
      }
   }
}

Open in new window


Here is the definition of the base class:
namespace Radius.Navigator.CommonContentTypes
{
   ///////////////////////////////////////////////////////////////////////////////
   /// <summary>
   /// Enumeration used by all operations to specify the operation type
   /// </summary>
   ///////////////////////////////////////////////////////////////////////////////
   [DataContract(Namespace = "http://schemas.radiusarm.com/NavigatorServices/2009/03")]
   public enum OCAVSOperationTypes
   {
      [EnumMember]
      None,

      [EnumMember]
      AgentLogon,

      [EnumMember]
      AgentStatus,

      [EnumMember]
      AgentHistory,

      [EnumMember]
      CampaignStatistics,

      [EnumMember]
      CampaignStatus,

      [EnumMember]
      LineStatus,

      [EnumMember]
      ResultCodeStatus,

      [EnumMember]
      SkillSetStatus,

      [EnumMember]
      Transaction,

      [EnumMember]
      MonitorEstablishAudio,

      [EnumMember]
      StartMonitor,

      [EnumMember]
      StopMonitor,

      [EnumMember]
      MonitorDeestablishAudio,

      [EnumMember]
      StopCampaign,

      [EnumMember]
      ReadCampaignSchedules,

      [EnumMember]
      LogOffAgent,

      [EnumMember]
      ReadSkillGroups,

      [EnumMember]
      RefreshSkillSetStatus,

      [EnumMember]
      AVSStartup,

      [EnumMember]
      AVSShutDown,

      [EnumMember]
      APDStartRequest,

      [EnumMember]
      APDStopRequest,

      [EnumMember]
      AVCStartRequest,

      [EnumMember]
      AVCStopRequest,

      [EnumMember]
      AVCHeartbeat,

      [EnumMember]
      AVCGetCampaignFileList,

      [EnumMember]
      AVCLogOffAgent,

      [EnumMember]
      AVCGetLoggedOnAgents,

      [EnumMember]
      HostStartRequest,

      [EnumMember]
      HostStopRequest,
   }


   ///////////////////////////////////////////////////////////////////////////////
   /// <summary>
   /// Base class used by all HostContentTypes classes 
   /// </summary>
   ///////////////////////////////////////////////////////////////////////////////
   [DataContract(Namespace = "http://schemas.radiusarm.com/NavigatorServices/2009/03")]
   public class OCAVSMessageBase
   {
      private OCAVSOperationTypes   m_operationType;
      private Int32                 m_sourceSystemId;
      private String                m_internalMessageId;
      private Int32                 m_destinationSystemId;

      ///////////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// The OperationType property provides the type of operation to perform
      /// </summary>
      ///////////////////////////////////////////////////////////////////////////////
      [DataMember(Name = "OperationType", IsRequired = false, Order = 0)]
      public OCAVSOperationTypes OperationType
      {
         get { return m_operationType; }
         set { m_operationType = value; }
      }

      ///////////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// SourceSystemId property provides the id of the Accelerator or 3rd-party host system.
      /// </summary>
      ///////////////////////////////////////////////////////////////////////////////
      [DataMember(Name = "SourceSystemId", IsRequired = true, Order = 1)]
      public Int32 SourceSystemId
      {
         get { return m_sourceSystemId; }
         set { m_sourceSystemId = value; }
      }

      ///////////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// InternalMessageId property provides an optional value used for diagnostic purposes.
      /// </summary>
      ///////////////////////////////////////////////////////////////////////////////
      [DataMember(Name = "InternalMessageId", IsRequired = false, Order = 2)]
      public String InternalMessageId
      {
         get { return m_internalMessageId; }
         set { m_internalMessageId = value; }
      }

      ///////////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// DestinationSystemId property provides the system id of the destination of the operation
      /// </summary>
      ///////////////////////////////////////////////////////////////////////////////
      [DataMember(Name = "DestinationSystemId", IsRequired = false, Order = 3)]
      public Int32 DestinationSystemId
      {
         get { return m_destinationSystemId; }
         set { m_destinationSystemId = value; }
      }

      ///////////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Constructor
      /// </summary>
      ///////////////////////////////////////////////////////////////////////////////
      public OCAVSMessageBase()
      {
         m_operationType         = OCAVSOperationTypes.None;
         m_sourceSystemId        = 0;
         m_destinationSystemId   = 0;
         m_internalMessageId     = String.Empty;
      }

      ///////////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Constructor
      /// </summary>
      /// <param name="operationType">
      /// Specifies the operation type
      /// </param>
      ///////////////////////////////////////////////////////////////////////////////
      public OCAVSMessageBase(OCAVSOperationTypes operationType)
      {
         m_operationType         = operationType;
         m_sourceSystemId        = 0;
         m_destinationSystemId   = 0;
         m_internalMessageId     = String.Empty;
      }
   }
}

Open in new window

Anybody?  I really need some assistance with this?
ASKER CERTIFIED SOLUTION
Avatar of SoCalKen99
SoCalKen99
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I gave the solution the lowest grade possible because of my disgust factor.