JetBrains Rider 2026.1 Help

Code inspection: Method is marked as [OperationContract] but containing type is not marked as [ServiceContract]

This inspection reports a method marked with [OperationContract] whose containing type is not marked with [ServiceContract]. That usually indicates an incomplete WCF contract and can lead to runtime problems.

Example

using System.ServiceModel; public interface ICalculator { [OperationContract] int Add(int x, int y); }
using System.ServiceModel; [ServiceContract] public interface ICalculator { [OperationContract] int Add(int x, int y); }

Quick-fix

One quick-fix adds [ServiceContract] to the containing type. Another quick-fix removes [OperationContract] if the method is not meant to be part of a service contract.

01 April 2026