@@ -1242,20 +1242,28 @@ protected internal override void SetExpectedDataType(Type dataType)
12421242 }
12431243 }
12441244
1245- private class ConverterFactory : IMessagePackConverterFactory
1245+ private class ConverterFactory : IMessagePackConverterFactory , ITypeShapeFunc
12461246 {
12471247 internal static readonly ConverterFactory Instance = new ( ) ;
12481248
12491249 private ConverterFactory ( )
12501250 {
12511251 }
12521252
1253- public MessagePackConverter < T > ? CreateConverter < T > ( ITypeShape < T > shape )
1254- => MessageFormatterProgressTracker . CanDeserialize ( typeof ( T ) ) || MessageFormatterProgressTracker . CanSerialize ( typeof ( T ) ) ? new ProgressConverter < T > ( ) :
1255- TrackerHelpers . IsIAsyncEnumerable ( typeof ( T ) ) ? ActivateAssociatedType < MessagePackConverter < T > > ( shape , typeof ( AsyncEnumerableConverter < > ) ) :
1256- TrackerHelpers . FindIAsyncEnumerableInterfaceImplementedBy ( typeof ( T ) ) is Type iface ? ActivateAssociatedType < MessagePackConverter < T > > ( shape , typeof ( AsyncEnumerableConverter < > ) ) :
1253+ public MessagePackConverter ? CreateConverter ( ITypeShape shape )
1254+ => MessageFormatterProgressTracker . CanDeserialize ( shape . Type ) || MessageFormatterProgressTracker . CanSerialize ( shape . Type ) ||
1255+ TrackerHelpers . IsIAsyncEnumerable ( shape . Type ) ||
1256+ TrackerHelpers . FindIAsyncEnumerableInterfaceImplementedBy ( shape . Type ) is Type ||
1257+ MessageFormatterRpcMarshaledContextTracker . TryGetMarshalOptionsForType ( shape , DefaultRpcMarshalableProxyOptions , out JsonRpcProxyOptions ? proxyOptions , out JsonRpcTargetOptions ? targetOptions , out RpcMarshalableAttribute ? attribute ) ||
1258+ typeof ( Exception ) . IsAssignableFrom ( shape . Type )
1259+ ? this . Invoke ( shape ) : null ;
1260+
1261+ object ? ITypeShapeFunc . Invoke < T > ( ITypeShape < T > shape , object ? state )
1262+ => MessageFormatterProgressTracker . CanDeserialize ( shape . Type ) || MessageFormatterProgressTracker . CanSerialize ( shape . Type ) ? new ProgressConverter < T > ( ) :
1263+ TrackerHelpers . IsIAsyncEnumerable ( shape . Type ) ? ActivateAssociatedType < MessagePackConverter < T > > ( shape , typeof ( AsyncEnumerableConverter < > ) ) :
1264+ TrackerHelpers . FindIAsyncEnumerableInterfaceImplementedBy ( shape . Type ) is Type iface ? ActivateAssociatedType < MessagePackConverter < T > > ( shape , typeof ( AsyncEnumerableConverter < > ) ) :
12571265 MessageFormatterRpcMarshaledContextTracker . TryGetMarshalOptionsForType ( shape , DefaultRpcMarshalableProxyOptions , out JsonRpcProxyOptions ? proxyOptions , out JsonRpcTargetOptions ? targetOptions , out RpcMarshalableAttribute ? attribute ) ? new RpcMarshalableConverter < T > ( shape , proxyOptions , targetOptions , attribute ) :
1258- typeof ( Exception ) . IsAssignableFrom ( typeof ( T ) ) ? new ExceptionConverter < T > ( ) :
1266+ typeof ( Exception ) . IsAssignableFrom ( shape . Type ) ? new ExceptionConverter < T > ( ) :
12591267 null ;
12601268 }
12611269
0 commit comments