File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -244,27 +244,17 @@ public ValueTask PrepareAsync()
244244 }
245245
246246 var type = result . GetType ( ) ;
247-
248- if ( type == typeof ( ValueTask ) || type == typeof ( Task ) )
249- {
250- dynamic task = result ;
251-
252- await task ;
253247
254- return null ;
255- }
256-
257- if ( type . IsAsyncGeneric ( ) )
248+ if ( ! type . IsAsync ( ) )
258249 {
259- dynamic task = result ;
260-
261- await task ;
262-
263- return type . IsGenericallyVoid ( ) ? null : task . Result ;
264-
250+ return result ;
265251 }
266252
267- return result ;
253+ await ( result as dynamic ) ;
254+
255+ var resultProperty = result . GetType ( ) . GetProperty ( "Result" ) ;
256+
257+ return resultProperty ? . GetValue ( result ) ;
268258 }
269259
270260 private static async ValueTask < IResponse ? > RenderCompilationErrorAsync ( IRequest request , CodeGenerationException error )
Original file line number Diff line number Diff line change 4949 <ProjectReference Include =" ..\Testing\Acceptance\GenHTTP.Testing.Acceptance.csproj" />
5050
5151 </ItemGroup >
52-
52+
5353</Project >
You can’t perform that action at this time.
0 commit comments