-
Notifications
You must be signed in to change notification settings - Fork 10
Revamp CoreIpc [ROBO-3791] #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
84bb59a
to
ad64ac2
Compare
-------- 1. Pipelines - (TBR) disable the constraint of pushing NuGet packages to the feed only when source branch is master - (TBD) restore, build and pack the main solution explicitly before running unit tests - Use .NET Runtime 8.0.8 and UseDotNet@2 for both 6.0.317 and 8.0.400 2. General - change the UiPath.CoreIpc* namespace to UiPath.Ipc* - decomission the usage of Nito - start optimizing logging via LoggerMessageAttribute 3. API and behavior - commission the new Ipc API that doesn't rely on the fluent builder pattern - commission the feature that allows the optional BeforeCall of an IpcServer Endpoint to share its AsyncLocal context with the target method execution, if the BeforeCall executes synchronously. Check the ServerBeforeCall_WhenSync_ShouldShareAsyncLocalContextWithTheTargetMethodCall test for further details. - extensibility support for potentially any transport, including JS-DotNetWasm interop 4. Internals - decommission the generic variant of ServiceClient, thus greatly simplifying the flow - commission the ServiceClientProper and ServiceClientForCallback subclasses
ad64ac2
to
6b263e6
Compare
- simplifications
- decommission WaitForStop
- decommission the duplication of IClient methods in Message
@@ -1,8 +1,10 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFrameworks>net6.0;net461;net6.0-windows</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should discuss this, not necessarily as part of this PR, but maybe we shouldn't target net6 anymore as it's out of support
using Microsoft.Extensions.DependencyInjection; | ||
using System.Text; | ||
using UiPath.Ipc; | ||
using UiPath.Ipc.Transport.NamedPipe; | ||
|
||
namespace UiPath.CoreIpc.Tests; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UiPath.Ipc.Tests*
NuGet.Config
Outdated
@@ -2,5 +2,6 @@ | |||
<configuration> | |||
<packageSources> | |||
<add key="Nuget" value="https://api.nuget.org/v3/index.json" /> | |||
<add key="UiPath-Internal" value="https://uipath.pkgs.visualstudio.com/Public.Feeds/_packaging/UiPath-Internal/nuget/v3/index.json" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem necessary
@@ -16,15 +16,15 @@ steps: | |||
|
|||
- task: DotNetCoreCLI@2 | |||
displayName: 'dotnet push to UiPath-Internal' | |||
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) | |||
condition: succeeded() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should discuss the release strategy
src/UiPath.CoreIpc.Extensions.Abstractions/UiPath.CoreIpc.Extensions.Abstractions.csproj
Outdated
Show resolved
Hide resolved
await _sendLock.WaitAsync(cancellationToken); | ||
try | ||
{ | ||
Logger?.LogInformation($"Connection.SendMessage: sendLock was successfully aquired. Pushing the bytes onto the network. ByteCount: {data.Length}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want these traces inside the lock?
c8a0895
to
078cfce
Compare
078cfce
to
a68ff89
Compare
d9d6e8b
to
b1db02f
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a major revamp of the CoreIpc library, focusing on API redesign, namespace consolidation, and improved extensibility. The changes include a shift from fluent builder patterns to direct configuration, enhanced transport abstractions, and optimized logging through attributes.
- Namespace migration from
UiPath.CoreIpc*
toUiPath.Ipc*
- New non-fluent IPC API replacing builder patterns
- Enhanced transport extensibility with improved abstractions
- Introduction of logging optimization via
LoggerMessageAttribute
Reviewed Changes
Copilot reviewed 170 out of 173 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
src/UiPath.CoreIpc/UiPath.CoreIpc.csproj |
Updated project configuration with new assembly name, namespace, and dependency versions |
src/UiPath.CoreIpc/Config/IpcServer.cs |
New IPC server implementation with required properties and async disposal |
src/UiPath.CoreIpc/Config/IpcClient.cs |
New IPC client implementation replacing builder pattern |
src/UiPath.CoreIpc/Client/ServiceClient.cs |
Major refactoring of service client architecture with new inheritance hierarchy |
src/UiPath.CoreIpc/Transport/ |
New transport abstraction layer for NamedPipe, TCP, and WebSocket implementations |
src/UiPath.CoreIpc/Logging/LoggingExtensions.cs |
New structured logging implementation using LoggerMessageAttribute |
src/UiPath.CoreIpc/Wire/Dtos.cs |
Updated DTOs with nullable reference types and simplified serialization |
Comments suppressed due to low confidence (1)
src/UiPath.CoreIpc/Transport/NamedPipe/NamedPipeServerTransport.cs:12
- [nitpick] The property name 'AccessControl' is ambiguous. Consider renaming to 'AccessControlConfig' or 'AccessControlSetup' to better indicate it's a delegate for configuring access control.
public AccessControlDelegate? AccessControl { get; init; }
REM generate-public-api --target-frameworks "net6.0" --assembly UiPath.Ipc.dll --project-path "D:\Alt\coreipc\src\UiPath.CoreIpc\UiPath.CoreIpc.csproj" --output-directory "D:\Alt\coreipc\src\UiPath.CoreIpc\report" --verbose | ||
REM generate-public-api --target-frameworks "net461" --assembly UiPath.Ipc.dll --project-path "D:\Alt\coreipc\src\UiPath.CoreIpc\UiPath.CoreIpc.csproj" --output-directory "D:\Alt\coreipc\src\UiPath.CoreIpc\report" --verbose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The batch file contains hardcoded absolute paths in the commented lines (lines 40-41). These should be removed or replaced with relative paths to improve maintainability and avoid exposing local development paths.
REM generate-public-api --target-frameworks "net6.0" --assembly UiPath.Ipc.dll --project-path "D:\Alt\coreipc\src\UiPath.CoreIpc\UiPath.CoreIpc.csproj" --output-directory "D:\Alt\coreipc\src\UiPath.CoreIpc\report" --verbose | |
REM generate-public-api --target-frameworks "net461" --assembly UiPath.Ipc.dll --project-path "D:\Alt\coreipc\src\UiPath.CoreIpc\UiPath.CoreIpc.csproj" --output-directory "D:\Alt\coreipc\src\UiPath.CoreIpc\report" --verbose | |
REM generate-public-api --target-frameworks "net6.0" --assembly UiPath.Ipc.dll --project-path "%projectPath%" --output-directory "%outputPath%" --verbose | |
REM generate-public-api --target-frameworks "net461" --assembly UiPath.Ipc.dll --project-path "%projectPath%" --output-directory "%outputPath%" --verbose |
Copilot uses AI. Check for mistakes.
public static readonly IpcJsonSerializer Instance = new(); | ||
|
||
static readonly JsonSerializer StringArgsSerializer = new() { CheckAdditionalContent = true }; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conditional compilation directive for AsyncMethodBuilder should include a comment explaining why it's excluded for NET461, as this affects performance optimization behavior.
// The AsyncMethodBuilder attribute is excluded for NET461 because the .NET Framework 4.6.1 | |
// does not support PoolingAsyncValueTaskMethodBuilder, which is used for performance optimization. |
Copilot uses AI. Check for mistakes.
=> Task.WhenAll(Enumerable.Range(start: 0, parallelCount).Select(_ => Task.Run(() => action(ct)))); | ||
} | ||
|
||
[MemberNotNullWhen(returnValue: true, member: nameof(Transport))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MemberNotNullWhen attribute references Transport, but the Transport property is marked as required and should never be null when the object is properly constructed. This attribute may be unnecessary or incorrectly applied.
[MemberNotNullWhen(returnValue: true, member: nameof(Transport))] |
Copilot uses AI. Check for mistakes.
{ | ||
Dispose(true); | ||
GC.SuppressFinalize(this); | ||
CloseConnection().AsTask().TraceError(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converting ValueTask to Task using AsTask() in the Dispose method may cause unnecessary allocations. Consider using ConfigureAwait(false) and handling the ValueTask directly, or ensure this is intentionally fire-and-forget.
Copilot uses AI. Check for mistakes.
/azp run CI |
Azure Pipelines successfully started running 1 pipeline(s). |
b40fa53
to
8e16244
Compare
/azp run CI |
Azure Pipelines successfully started running 1 pipeline(s). |
Changes:
Pipelines
only when the source branch is
master
before running unit tests
General
API and behavior
of an IpcServer Endpoint to share its AsyncLocal context
with the target method execution, if the BeforeCall executes
synchronously.
Check the ServerBeforeCall_WhenSync_ShouldShareAsyncLocalContextWithTheTargetMethodCall test for further details.
Internals