@@ -110,14 +110,29 @@ public interface IMyService
110
110
void SyncEmpty ( ) ;
111
111
}
112
112
113
+ /// <summary>
114
+ /// An interface which is not marked with [Service] attribute.
115
+ /// Its methods are not expected to participate in reflection at all.
116
+ /// </summary>
117
+ public interface INotAService
118
+ {
119
+ ValueTask < MyResponse > NotAServiceUnary ( MyRequest request , CallContext callContext = default ) ;
120
+ ValueTask < MyResponse > NotAServiceClientStreaming ( IAsyncEnumerable < MyRequest > request , CallContext callContext = default ) ;
121
+ IAsyncEnumerable < MyResponse > NotAServiceServerStreaming ( MyRequest request , CallContext callContext = default ) ;
122
+ IAsyncEnumerable < MyResponse > NotAServiceFullDuplex ( IAsyncEnumerable < MyRequest > request , CallContext callContext = default ) ;
123
+
124
+ ValueTask NotAServiceAsyncEmpty ( ) ;
125
+ void NotAServiceSyncEmpty ( ) ;
126
+ }
127
+
113
128
[ Service ]
114
- public interface ISomeGenericService < TGenericRequest , TGenericResult >
129
+ public interface ISomeGenericService < in TGenericRequest , TGenericResult >
115
130
{
116
131
ValueTask < TGenericResult > GenericUnary ( TGenericRequest request , CallContext callContext = default ) ;
117
132
}
118
133
119
134
[ Service ]
120
- public interface IMyInheritedService : IMyService , ISomeGenericService < MyRequest , MyResponse >
135
+ public interface IMyInheritedService : IMyService , ISomeGenericService < MyRequest , MyResponse > , INotAService
121
136
{
122
137
ValueTask < MyResponse > InheritedUnary ( MyRequest request , CallContext callContext = default ) ;
123
138
ValueTask < MyResponse > InheritedClientStreaming ( IAsyncEnumerable < MyRequest > request , CallContext callContext = default ) ;
@@ -212,5 +227,13 @@ service ConferencesService {
212
227
}
213
228
" , proto , ignoreLineEndingDifferences : true ) ;
214
229
}
230
+
231
+ [ Fact ]
232
+ public void WhenInterfaceIsNotServiceContract_Throw ( )
233
+ {
234
+ var generator = new SchemaGenerator ( ) ;
235
+ Action activation = ( ) => generator . GetSchema < INotAService > ( ) ;
236
+ Assert . Throws < ArgumentException > ( activation . Invoke ) ;
237
+ }
215
238
}
216
239
}
0 commit comments