Skip to content

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

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open

Revamp CoreIpc [ROBO-3791] #106

wants to merge 25 commits into from

Conversation

eduard-dumitru
Copy link
Collaborator

@eduard-dumitru eduard-dumitru commented Oct 9, 2024

Changes:

  • Pipelines

    • (TBR) disable the constraint of pushing NuGet packages to the feed
      only when the 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
  • General

    • change the UiPath.CoreIpc* namespace to UiPath.Ipc*
    • decommission the usage of Nito
    • start optimizing logging via LoggerMessageAttribute
  • 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
  • Internals

    • decommission the generic variant of ServiceClient, thus greatly simplifying the flow
    • commission the ServiceClientProper and ServiceClientForCallback subclasses

@eduard-dumitru eduard-dumitru force-pushed the feat/revamp_lean branch 2 times, most recently from 84bb59a to ad64ac2 Compare October 9, 2024 13:27
--------

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
@eduard-dumitru eduard-dumitru marked this pull request as ready for review October 17, 2024 11:14
@eduard-dumitru eduard-dumitru changed the title Revamp CoreIpc (lean) Revamp CoreIpc [ROBO-3791] Oct 22, 2024
@@ -1,8 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net461;net6.0-windows</TargetFrameworks>
Copy link
Member

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;
Copy link
Member

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" />
Copy link
Member

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()
Copy link
Member

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

await _sendLock.WaitAsync(cancellationToken);
try
{
Logger?.LogInformation($"Connection.SendMessage: sendLock was successfully aquired. Pushing the bytes onto the network. ByteCount: {data.Length}");
Copy link
Member

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?

@eduard-dumitru eduard-dumitru force-pushed the feat/revamp_lean branch 2 times, most recently from c8a0895 to 078cfce Compare July 14, 2025 13:06
@eduard-dumitru eduard-dumitru requested a review from Copilot July 14, 2025 15:35
Copilot

This comment was marked as outdated.

Copilot

This comment was marked as outdated.

Copilot

This comment was marked as outdated.

@eduard-dumitru eduard-dumitru requested a review from Copilot July 14, 2025 16:07
Copilot

This comment was marked as outdated.

@eduard-dumitru
Copy link
Collaborator Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@eduard-dumitru eduard-dumitru requested a review from Copilot July 14, 2025 17:22
Copilot

This comment was marked as outdated.

@eduard-dumitru eduard-dumitru requested a review from Copilot July 14, 2025 17:32
Copilot

This comment was marked as outdated.

@eduard-dumitru eduard-dumitru requested a review from Copilot July 16, 2025 12:56
Copy link

@Copilot Copilot AI left a 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* to UiPath.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; }

Comment on lines +40 to +41
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
Copy link
Preview

Copilot AI Jul 16, 2025

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.

Suggested change
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 };

Copy link
Preview

Copilot AI Jul 16, 2025

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.

Suggested change
// 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))]
Copy link
Preview

Copilot AI Jul 16, 2025

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.

Suggested change
[MemberNotNullWhen(returnValue: true, member: nameof(Transport))]

Copilot uses AI. Check for mistakes.

{
Dispose(true);
GC.SuppressFinalize(this);
CloseConnection().AsTask().TraceError();
Copy link
Preview

Copilot AI Jul 16, 2025

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.

@eduard-dumitru
Copy link
Collaborator Author

/azp run CI

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@eduard-dumitru
Copy link
Collaborator Author

/azp run CI

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants