Skip to content

Commit b53aeb0

Browse files
reduce public api 1st round
1 parent ab26f0c commit b53aeb0

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/UiPath.CoreIpc.Tests/NestedStreamTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ public async Task ReadAsync_ValidatesArguments()
358358
await Assert.ThrowsAsync<ArgumentException>(() => this.stream.ReadAsync(buffer, 1, buffer.Length));
359359
}
360360
}
361-
public static class StreamExtensions
361+
internal static class StreamExtensions
362362
{
363363
/// <summary>
364364
/// Creates a <see cref="Stream"/> that can read no more than a given number of bytes from an underlying stream.

src/UiPath.CoreIpc/Helpers.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ public static async Task ConnectAsync(this TcpClient tcpClient, IPAddress addres
1919
await tcpClient.ConnectAsync(address, port);
2020
}
2121
#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());
2323
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);
2525
[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");
2727
[Conditional("DEBUG")]
28-
public static void AssertDisposed(this CancellationTokenSource cts)
28+
internal static void AssertDisposed(this CancellationTokenSource cts)
2929
{
3030
#if NET461
3131
cts.AssertFieldNull("m_kernelEvent");
@@ -38,10 +38,10 @@ public static void AssertDisposed(this CancellationTokenSource cts)
3838
[Conditional("DEBUG")]
3939
static void AssertFieldNull(this object obj, string field) =>
4040
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 =>
4242
(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)
4545
{
4646
var method = type.GetMethod(name, InstanceFlags) ??
4747
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)
5252
}
5353
return method;
5454
}
55-
public static IEnumerable<MethodInfo> GetInterfaceMethods(this Type type) =>
55+
internal static IEnumerable<MethodInfo> GetInterfaceMethods(this Type type) =>
5656
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
5858
{
5959
{ HasDefaultValue: false } => null,
6060
{ ParameterType: { IsValueType: true }, DefaultValue: null } => Activator.CreateInstance(parameter.ParameterType),
6161
_ => parameter.DefaultValue
6262
};
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);
6464
public static void LogException(this ILogger logger, Exception ex, object tag)
6565
{
6666
var message = $"{tag} # {ex}";
@@ -167,7 +167,7 @@ private static async ValueTask WriteMessageCore(this Stream stream, RecyclableMe
167167
internal static Task WriteBuffer(this Stream stream, byte[] buffer, CancellationToken cancellationToken) =>
168168
stream.WriteAsync(buffer, 0, buffer.Length, cancellationToken);
169169
}
170-
public static class Validator
170+
internal static class Validator
171171
{
172172
public static void Validate(ServiceHostBuilder serviceHostBuilder)
173173
{
@@ -267,7 +267,7 @@ private static void CheckDerivedStream(MethodInfo method, Type type)
267267
}
268268
}
269269
}
270-
public readonly struct TimeoutHelper : IDisposable
270+
internal readonly struct TimeoutHelper : IDisposable
271271
{
272272
private static readonly Action<object> LinkedTokenCancelDelegate = static s => ((CancellationTokenSource)s).Cancel();
273273
private readonly PooledCancellationTokenSource _timeoutCancellationSource;

src/UiPath.CoreIpc/NestedStream.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/// A stream that allows for reading from another stream up to a given number of bytes.
55
/// https://github.com/AArnott/Nerdbank.Streams/blob/3303c541c29b979f61c86c3c2ed5c0e7372d7a55/src/Nerdbank.Streams/NestedStream.cs#L18
66
/// </summary>
7-
public class NestedStream : Stream
7+
internal class NestedStream : Stream
88
{
99
/// <summary>
1010
/// The stream to read from.

0 commit comments

Comments
 (0)