@@ -20,7 +20,7 @@ namespace Castle.DynamicProxy
2020 Justification = "Must propagate the same exceptions." ) ]
2121 public abstract class AsyncInterceptorBase : IAsyncInterceptor
2222 {
23- #if ! NETSTANDARD2_0
23+ #if ! NETSTANDARD2_0 && ! NET5_0
2424 /// <summary>
2525 /// A completed <see cref="Task"/>.
2626 /// </summary>
@@ -43,7 +43,7 @@ public abstract class AsyncInterceptorBase : IAsyncInterceptor
4343 /// Intercepts a synchronous method <paramref name="invocation"/>.
4444 /// </summary>
4545 /// <param name="invocation">The method invocation.</param>
46- void IAsyncInterceptor . InterceptSynchronous ( IInvocation invocation )
46+ public void InterceptSynchronous ( IInvocation invocation )
4747 {
4848 Type returnType = invocation . Method . ReturnType ;
4949 GenericSynchronousHandler handler = GenericSynchronousHandlers . GetOrAdd ( returnType , CreateHandler ) ;
@@ -54,7 +54,7 @@ void IAsyncInterceptor.InterceptSynchronous(IInvocation invocation)
5454 /// Intercepts an asynchronous method <paramref name="invocation"/> with return type of <see cref="Task"/>.
5555 /// </summary>
5656 /// <param name="invocation">The method invocation.</param>
57- void IAsyncInterceptor . InterceptAsynchronous ( IInvocation invocation )
57+ public void InterceptAsynchronous ( IInvocation invocation )
5858 {
5959 invocation . ReturnValue = InterceptAsync ( invocation , invocation . CaptureProceedInfo ( ) , ProceedAsynchronous ) ;
6060 }
@@ -64,7 +64,7 @@ void IAsyncInterceptor.InterceptAsynchronous(IInvocation invocation)
6464 /// </summary>
6565 /// <typeparam name="TResult">The type of the <see cref="Task{T}"/> <see cref="Task{T}.Result"/>.</typeparam>
6666 /// <param name="invocation">The method invocation.</param>
67- void IAsyncInterceptor . InterceptAsynchronous < TResult > ( IInvocation invocation )
67+ public void InterceptAsynchronous < TResult > ( IInvocation invocation )
6868 {
6969 invocation . ReturnValue =
7070 InterceptAsync ( invocation , invocation . CaptureProceedInfo ( ) , ProceedAsynchronous < TResult > ) ;
@@ -138,15 +138,15 @@ private static Task ProceedSynchronous(IInvocation invocation, IInvocationProcee
138138 try
139139 {
140140 proceedInfo . Invoke ( ) ;
141- #if NETSTANDARD2_0
141+ #if NETSTANDARD2_0 || NET5_0
142142 return Task . CompletedTask ;
143143#else
144144 return CompletedTask ;
145145#endif
146146 }
147147 catch ( Exception e )
148148 {
149- #if NETSTANDARD2_0
149+ #if NETSTANDARD2_0 || NET5_0
150150 return Task . FromException ( e ) ;
151151#else
152152 var tcs = new TaskCompletionSource < int > ( ) ;
@@ -167,7 +167,7 @@ private static Task<TResult> ProceedSynchronous<TResult>(
167167 }
168168 catch ( Exception e )
169169 {
170- #if NETSTANDARD2_0
170+ #if NETSTANDARD2_0 || NET5_0
171171 return Task . FromException < TResult > ( e ) ;
172172#else
173173 var tcs = new TaskCompletionSource < TResult > ( ) ;
@@ -177,6 +177,7 @@ private static Task<TResult> ProceedSynchronous<TResult>(
177177 }
178178 }
179179
180+ [ SuppressMessage ( "Style" , "IDE1006:Naming Styles" , Justification = "The name explicitly says Asynchronous." ) ]
180181 private static async Task ProceedAsynchronous ( IInvocation invocation , IInvocationProceedInfo proceedInfo )
181182 {
182183 proceedInfo . Invoke ( ) ;
@@ -187,6 +188,7 @@ private static async Task ProceedAsynchronous(IInvocation invocation, IInvocatio
187188 await originalReturnValue . ConfigureAwait ( false ) ;
188189 }
189190
191+ [ SuppressMessage ( "Style" , "IDE1006:Naming Styles" , Justification = "The name explicitly says Asynchronous." ) ]
190192 private static async Task < TResult > ProceedAsynchronous < TResult > (
191193 IInvocation invocation ,
192194 IInvocationProceedInfo proceedInfo )
0 commit comments