File tree Expand file tree Collapse file tree 2 files changed +54
-2
lines changed
src/protobuf-net.Grpc/Internal
tests/protobuf-net.Grpc.Test.Integration/Issues Expand file tree Collapse file tree 2 files changed +54
-2
lines changed Original file line number Diff line number Diff line change @@ -286,9 +286,17 @@ public static List<ContractOperation> FindOperations(BinderConfiguration binderC
286
286
287
287
internal MethodInfo ? TryGetClientHelper ( )
288
288
{
289
+
289
290
var name = GetClientHelperName ( ) ;
290
- if ( name == null || ! s_reshaper . TryGetValue ( name , out var method ) ) return null ;
291
- return method . MakeGenericMethod ( From , To ) ;
291
+ try
292
+ {
293
+ if ( name == null || ! s_reshaper . TryGetValue ( name , out var method ) ) return null ;
294
+ return method . MakeGenericMethod ( From , To ) ;
295
+ }
296
+ catch ( Exception ex )
297
+ {
298
+ throw new InvalidOperationException ( $ "Error obtaining client-helper '{ name } ' (from: '{ From ? . FullName } ', to: '{ To ? . FullName } '): { ex . Message } ", ex ) ;
299
+ }
292
300
}
293
301
#pragma warning disable CS0618 // Reshape
294
302
static readonly Dictionary < string , MethodInfo > s_reshaper =
Original file line number Diff line number Diff line change
1
+ using Grpc . Core ;
2
+ using ProtoBuf . Grpc . Client ;
3
+ using System . Collections . Generic ;
4
+ using System . Runtime . Serialization ;
5
+ using System . ServiceModel ;
6
+ using System . Threading . Tasks ;
7
+ using Xunit ;
8
+
9
+ namespace protobuf_net . Grpc . Test . Integration . Issues
10
+ {
11
+ public class SO62732593
12
+ {
13
+ [ Fact ]
14
+ public void CanCreateProxy ( )
15
+ {
16
+ Channel channel = new Channel ( "none" , ChannelCredentials . Insecure ) ;
17
+ var svc = channel . CreateGrpcService < ICustomerService > ( ) ;
18
+ Assert . NotNull ( svc ) ;
19
+ }
20
+
21
+ [ DataContract ]
22
+ public class CustomerResultSet
23
+ {
24
+ [ DataMember ( Order = 1 ) ]
25
+ public IEnumerable < Customer > Customers { get ; set ; }
26
+ }
27
+ [ DataContract ]
28
+ public partial class Customer
29
+ {
30
+ [ DataMember ( Order = 1 ) ]
31
+ public int CustomerId { get ; set ; }
32
+ [ DataMember ( Order = 2 ) ]
33
+ public string CustomerName { get ; set ; }
34
+ }
35
+
36
+ [ ServiceContract ( Name = "Services.Customer" ) ]
37
+ public interface ICustomerService
38
+ {
39
+ ValueTask < Customer > CreateCustomer ( Customer customerDTO ) ;
40
+
41
+ ValueTask < CustomerResultSet > GetCustomers ( ) ;
42
+ }
43
+ }
44
+ }
You can’t perform that action at this time.
0 commit comments