Code inspection: Interfaces marked as ServiceContract should declare at least one OperationContract
This inspection reports an interface marked with [ServiceContract] that does not declare any [OperationContract] methods. That usually means the contract is incomplete and will not expose any service operations.
Example
using System.ServiceModel;
[ServiceContract]
public interface ICalculator
{
int Add(int x, int y);
}
using System.ServiceModel;
[ServiceContract]
public interface ICalculator
{
[OperationContract]
int Add(int x, int y);
}
Quick-fix
The quick-fix adds [OperationContract] to the interface methods.
01 April 2026