@@ -19,13 +19,13 @@ public static async Task ConnectAsync(this TcpClient tcpClient, IPAddress addres
19
19
await tcpClient . ConnectAsync ( address , port ) ;
20
20
}
21
21
#endif
22
- public static Error ToError ( this Exception ex ) => new ( ex . Message , ex . StackTrace ?? ex . GetBaseException ( ) . StackTrace , GetExceptionType ( ex ) , ex . InnerException ? . ToError ( ) ) ;
22
+ internal static Error ToError ( this Exception ex ) => new ( ex . Message , ex . StackTrace ?? ex . GetBaseException ( ) . StackTrace , GetExceptionType ( ex ) , ex . InnerException ? . ToError ( ) ) ;
23
23
private static string GetExceptionType ( Exception exception ) => ( exception as RemoteException ) ? . Type ?? exception . GetType ( ) . FullName ;
24
- public static bool Enabled ( this ILogger logger ) => logger != null && logger . IsEnabled ( LogLevel . Information ) ;
24
+ internal static bool Enabled ( this ILogger logger ) => logger != null && logger . IsEnabled ( LogLevel . Information ) ;
25
25
[ Conditional ( "DEBUG" ) ]
26
- public static void AssertDisposed ( this SemaphoreSlim semaphore ) => semaphore . AssertFieldNull ( "m_waitHandle" ) ;
26
+ internal static void AssertDisposed ( this SemaphoreSlim semaphore ) => semaphore . AssertFieldNull ( "m_waitHandle" ) ;
27
27
[ Conditional ( "DEBUG" ) ]
28
- public static void AssertDisposed ( this CancellationTokenSource cts )
28
+ internal static void AssertDisposed ( this CancellationTokenSource cts )
29
29
{
30
30
#if NET461
31
31
cts . AssertFieldNull ( "m_kernelEvent" ) ;
@@ -38,10 +38,10 @@ public static void AssertDisposed(this CancellationTokenSource cts)
38
38
[ Conditional ( "DEBUG" ) ]
39
39
static void AssertFieldNull ( this object obj , string field ) =>
40
40
Debug . Assert ( obj . GetType ( ) . GetField ( field , BindingFlags . Instance | BindingFlags . NonPublic ) . GetValue ( obj ) == null ) ;
41
- public static TDelegate MakeGenericDelegate < TDelegate > ( this MethodInfo genericMethod , Type genericArgument ) where TDelegate : Delegate =>
41
+ internal static TDelegate MakeGenericDelegate < TDelegate > ( this MethodInfo genericMethod , Type genericArgument ) where TDelegate : Delegate =>
42
42
( TDelegate ) genericMethod . MakeGenericMethod ( genericArgument ) . CreateDelegate ( typeof ( TDelegate ) ) ;
43
- public static MethodInfo GetStaticMethod ( this Type type , string name ) => type . GetMethod ( name , BindingFlags . Static | BindingFlags . NonPublic ) ;
44
- public static MethodInfo GetInterfaceMethod ( this Type type , string name )
43
+ internal static MethodInfo GetStaticMethod ( this Type type , string name ) => type . GetMethod ( name , BindingFlags . Static | BindingFlags . NonPublic ) ;
44
+ internal static MethodInfo GetInterfaceMethod ( this Type type , string name )
45
45
{
46
46
var method = type . GetMethod ( name , InstanceFlags ) ??
47
47
type . GetInterfaces ( ) . Select ( t => t . GetMethod ( name , InstanceFlags ) ) . FirstOrDefault ( m => m != null ) ??
@@ -52,15 +52,15 @@ public static MethodInfo GetInterfaceMethod(this Type type, string name)
52
52
}
53
53
return method ;
54
54
}
55
- public static IEnumerable < MethodInfo > GetInterfaceMethods ( this Type type ) =>
55
+ internal static IEnumerable < MethodInfo > GetInterfaceMethods ( this Type type ) =>
56
56
type . GetMethods ( ) . Concat ( type . GetInterfaces ( ) . SelectMany ( i => i . GetMethods ( ) ) ) ;
57
- public static object GetDefaultValue ( this ParameterInfo parameter ) => parameter switch
57
+ internal static object GetDefaultValue ( this ParameterInfo parameter ) => parameter switch
58
58
{
59
59
{ HasDefaultValue : false } => null ,
60
60
{ ParameterType : { IsValueType : true } , DefaultValue : null } => Activator . CreateInstance ( parameter . ParameterType ) ,
61
61
_ => parameter . DefaultValue
62
62
} ;
63
- public static ReadOnlyDictionary < TKey , TValue > ToReadOnlyDictionary < TKey , TValue > ( this IDictionary < TKey , TValue > dictionary ) => new ( dictionary ) ;
63
+ internal static ReadOnlyDictionary < TKey , TValue > ToReadOnlyDictionary < TKey , TValue > ( this IDictionary < TKey , TValue > dictionary ) => new ( dictionary ) ;
64
64
public static void LogException ( this ILogger logger , Exception ex , object tag )
65
65
{
66
66
var message = $ "{ tag } # { ex } ";
@@ -167,7 +167,7 @@ private static async ValueTask WriteMessageCore(this Stream stream, RecyclableMe
167
167
internal static Task WriteBuffer ( this Stream stream , byte [ ] buffer , CancellationToken cancellationToken ) =>
168
168
stream . WriteAsync ( buffer , 0 , buffer . Length , cancellationToken ) ;
169
169
}
170
- public static class Validator
170
+ internal static class Validator
171
171
{
172
172
public static void Validate ( ServiceHostBuilder serviceHostBuilder )
173
173
{
@@ -267,7 +267,7 @@ private static void CheckDerivedStream(MethodInfo method, Type type)
267
267
}
268
268
}
269
269
}
270
- public readonly struct TimeoutHelper : IDisposable
270
+ internal readonly struct TimeoutHelper : IDisposable
271
271
{
272
272
private static readonly Action < object > LinkedTokenCancelDelegate = static s => ( ( CancellationTokenSource ) s ) . Cancel ( ) ;
273
273
private readonly PooledCancellationTokenSource _timeoutCancellationSource ;
0 commit comments