├── .editorconfig
├── .gitattributes
├── .gitignore
├── DotNetTest.bat
├── LICENSE
├── README.md
├── UiPath.Rpc
├── CI
│ ├── azp-dotnet-dist.yaml
│ ├── azp-dotnet.yaml
│ ├── azp-initialization.yaml
│ └── azp-start.yaml
├── NuGet.Config
├── RpcSample.ConsoleClient
│ ├── App1.config
│ ├── Client.cs
│ ├── RpcSample.ConsoleClient.csproj
│ ├── TcpClient.cs
│ ├── WebSocketClient.cs
│ └── app1.manifest
├── RpcSample.ConsoleServer
│ ├── App1.config
│ ├── RpcSample.ConsoleServer.csproj
│ ├── Server.cs
│ ├── TcpServer.cs
│ ├── WebSocketServer.cs
│ └── app1.manifest
├── UiPath.Rpc.Tests
│ ├── ComputingTests.cs
│ ├── EndpointTests.cs
│ ├── Implementation
│ │ ├── ComputingCallback.cs
│ │ ├── ComputingService.cs
│ │ ├── IpcHelpers.cs
│ │ ├── OneWayStreamWrapper.cs
│ │ └── SystemService.cs
│ ├── NamedPipeTests.cs
│ ├── NestedStreamTests.cs
│ ├── SystemTests.cs
│ ├── TcpTests..cs
│ ├── TestBase.cs
│ ├── UiPath.Rpc.Tests.csproj
│ ├── ValidationTests.cs
│ └── WebSocketTests.cs
├── UiPath.Rpc.sln
└── UiPath.Rpc
│ ├── CancellationTokenSourcePool.cs
│ ├── Client
│ ├── ClientConnectionsRegistry.cs
│ ├── ServiceClient.cs
│ └── ServiceClientBuilder.cs
│ ├── Connection.cs
│ ├── Dtos.cs
│ ├── GlobalSuppressions.cs
│ ├── Helpers.cs
│ ├── NamedPipe
│ ├── NamedPipeClient.cs
│ ├── NamedPipeClientBuilder.cs
│ └── NamedPipeListener.cs
│ ├── NestedStream.cs
│ ├── Server
│ ├── Listener.cs
│ ├── Server.cs
│ ├── ServerConnection.cs
│ ├── ServiceHost.cs
│ └── ServiceHostBuilder.cs
│ ├── TaskCompletionPool.cs
│ ├── Tcp
│ ├── TcpClient.cs
│ ├── TcpClientBuilder.cs
│ └── TcpListener.cs
│ ├── UiPath.Rpc.csproj
│ └── WebSockets
│ ├── WebSocketClient.cs
│ ├── WebSocketClientBuilder.cs
│ ├── WebSocketListener.cs
│ └── WebSocketStream.cs
└── src
├── CI
├── azp-dotnet-dist.yaml
├── azp-dotnet.yaml
├── azp-initialization.yaml
├── azp-js.publish-npm.steps.yaml
├── azp-nodejs-dist.yaml
├── azp-nodejs.yaml
└── azp-start.yaml
├── Clients
└── js
│ ├── .editorconfig
│ ├── .gitignore
│ ├── .nycrc
│ ├── .prettierrc.json
│ ├── .vscode
│ └── settings.json
│ ├── README.md
│ ├── assets
│ ├── js-16x16.png
│ ├── js-24x24.png
│ ├── js-32x32.png
│ ├── js-48x48.png
│ ├── node
│ │ ├── README.md
│ │ └── npm-32x32.png
│ ├── npm-16x16.png
│ ├── npm-32x32.png
│ ├── npm.png
│ ├── npm.svg
│ ├── web-js
│ │ ├── README.md
│ │ └── js-32x32.png
│ └── web
│ │ ├── README.md
│ │ └── npm-32x32.png
│ ├── dist-packages
│ └── .gitkeep
│ ├── dotnet
│ ├── UiPath.CoreIpc.NodeInterop.sln
│ └── UiPath.CoreIpc.NodeInterop
│ │ ├── CompilerServices.cs
│ │ ├── Contracts.cs
│ │ ├── Program.cs
│ │ ├── Properties
│ │ └── launchSettings.json
│ │ ├── ServiceImpls.cs
│ │ ├── Signalling.cs
│ │ └── UiPath.CoreIpc.NodeInterop.csproj
│ ├── jasmine-console-reporter.d.ts
│ ├── jasmine.node.json
│ ├── jasmine.node.ts
│ ├── karma.conf.js
│ ├── package-lock.json
│ ├── package.json
│ ├── readme-assets
│ ├── diagram.png
│ ├── dotnet.png
│ ├── nodejs.png
│ ├── npm.png
│ └── nuget.png
│ ├── republish.bat
│ ├── src
│ ├── node
│ │ ├── Ipc.ts
│ │ ├── NodeAddressBuilder.ts
│ │ ├── Platform.ts
│ │ ├── Transport
│ │ │ ├── NamedPipes
│ │ │ │ ├── NamedPipeAddress.ts
│ │ │ │ ├── NamedPipeSocket.ts
│ │ │ │ ├── NamedPipeSocketLike.ts
│ │ │ │ ├── NamedPipeSocketLikeCtor.ts
│ │ │ │ └── index.ts
│ │ │ ├── WebSockets
│ │ │ │ ├── NodeWebSocket.ts
│ │ │ │ ├── NodeWebSocketAddress.ts
│ │ │ │ ├── NodeWebSocketError.ts
│ │ │ │ ├── NodeWebSocketLike.ts
│ │ │ │ ├── NodeWebSocketLikeCtor.ts
│ │ │ │ └── index.ts
│ │ │ └── index.ts
│ │ └── index.ts
│ ├── std
│ │ ├── bcl
│ │ │ ├── cancellation
│ │ │ │ ├── CancellationToken.ts
│ │ │ │ ├── CancellationTokenRegistration.ts
│ │ │ │ ├── CancellationTokenSource.ts
│ │ │ │ ├── EmptyCancellationToken.ts
│ │ │ │ ├── LinkedCancellationTokenSource.ts
│ │ │ │ ├── RandomCancellationToken.ts
│ │ │ │ └── index.ts
│ │ │ ├── collections
│ │ │ │ ├── ConditionalWeakTable.ts
│ │ │ │ ├── Dictionary.ts
│ │ │ │ └── index.ts
│ │ │ ├── diagnostics
│ │ │ │ ├── Trace.ts
│ │ │ │ └── index.ts
│ │ │ ├── disposable
│ │ │ │ ├── AggregateDisposable.ts
│ │ │ │ ├── IAsyncDisposable.ts
│ │ │ │ ├── IDisposable.ts
│ │ │ │ └── index.ts
│ │ │ ├── errors
│ │ │ │ ├── AggregateError.ts
│ │ │ │ ├── ArgumentError.ts
│ │ │ │ ├── ArgumentErrorBase.ts
│ │ │ │ ├── ArgumentNullError.ts
│ │ │ │ ├── ArgumentOutOfRangeError.ts
│ │ │ │ ├── CoreIpcError.ts
│ │ │ │ ├── EndOfStreamError.ts
│ │ │ │ ├── InvalidOperationError.ts
│ │ │ │ ├── ObjectDisposedError.ts
│ │ │ │ ├── OperationCanceledError.ts
│ │ │ │ ├── PlatformNotSupportedError.ts
│ │ │ │ ├── TimeoutError.ts
│ │ │ │ ├── UnknownError.ts
│ │ │ │ └── index.ts
│ │ │ ├── helpers
│ │ │ │ ├── argumentIs.ts
│ │ │ │ ├── index.ts
│ │ │ │ └── nameof.ts
│ │ │ ├── index.ts
│ │ │ ├── io
│ │ │ │ ├── BitConverter.ts
│ │ │ │ ├── Marshal.ts
│ │ │ │ ├── Socket.ts
│ │ │ │ ├── SocketStream.ts
│ │ │ │ ├── Stream.ts
│ │ │ │ ├── SupportedConversion.ts
│ │ │ │ └── index.ts
│ │ │ ├── promises
│ │ │ │ ├── FinalState.ts
│ │ │ │ ├── PromiseCompletionSource.ts
│ │ │ │ ├── PromiseCompletionSourceInternal.ts
│ │ │ │ ├── PromisePal.ts
│ │ │ │ ├── PromiseSpy.ts
│ │ │ │ ├── PromiseSpyImpl.ts
│ │ │ │ ├── PromiseStatus.ts
│ │ │ │ └── index.ts
│ │ │ ├── reflection
│ │ │ │ ├── Constructor
│ │ │ │ │ ├── ParameterlessPublic.ts
│ │ │ │ │ ├── PublicCtor.ts
│ │ │ │ │ ├── UnnamedPublicCtor.ts
│ │ │ │ │ └── index.ts
│ │ │ │ ├── ObjectPal.ts
│ │ │ │ ├── Type
│ │ │ │ │ ├── ExtendedType.ts
│ │ │ │ │ ├── Primitive.ts
│ │ │ │ │ ├── PrimitiveDefinedNonObjectTypeName.ts
│ │ │ │ │ ├── PrimitiveDefinedTypeName.ts
│ │ │ │ │ ├── PrimitiveTypeName.ts
│ │ │ │ │ └── index.ts
│ │ │ │ └── index.ts
│ │ │ ├── serialization
│ │ │ │ ├── JsonConvert.ts
│ │ │ │ └── index.ts
│ │ │ ├── synchronization
│ │ │ │ ├── AsyncAutoResetEvent.ts
│ │ │ │ └── index.ts
│ │ │ ├── system
│ │ │ │ ├── IPlatform.ts
│ │ │ │ └── index.ts
│ │ │ └── time
│ │ │ │ ├── TimeSpan.ts
│ │ │ │ ├── Timeout.ts
│ │ │ │ └── index.ts
│ │ ├── core
│ │ │ ├── Addresses
│ │ │ │ ├── Address.ts
│ │ │ │ ├── AddressBuilder.ts
│ │ │ │ ├── AddressSelectionDelegate.ts
│ │ │ │ └── index.ts
│ │ │ ├── Annotations
│ │ │ │ ├── OperationAnnotations.ts
│ │ │ │ ├── OperationAnnotationsWrapper.ts
│ │ │ │ ├── ServiceAnnotations.ts
│ │ │ │ ├── ServiceAnnotationsWrapper.ts
│ │ │ │ └── index.ts
│ │ │ ├── Callbacks
│ │ │ │ ├── Callback.ts
│ │ │ │ ├── CallbackImpl.ts
│ │ │ │ └── index.ts
│ │ │ ├── Configuration
│ │ │ │ ├── ConfigStore.ts
│ │ │ │ ├── ConnectContext.ts
│ │ │ │ ├── ConnectHelper.ts
│ │ │ │ └── index.ts
│ │ │ ├── Contract
│ │ │ │ ├── ContractStore.ts
│ │ │ │ ├── IContractStore.ts
│ │ │ │ ├── Message.ts
│ │ │ │ ├── OperationDescriptor.ts
│ │ │ │ ├── OperationDescriptorImpl.ts
│ │ │ │ ├── OperationDescriptorTable.ts
│ │ │ │ ├── ServiceDescriptor.ts
│ │ │ │ ├── ServiceDescriptorImpl.ts
│ │ │ │ └── index.ts
│ │ │ ├── IServiceProvider.ts
│ │ │ ├── IpcBase.ts
│ │ │ ├── Protocol
│ │ │ │ ├── Errors
│ │ │ │ │ ├── IpcError.ts
│ │ │ │ │ ├── RemoteError.ts
│ │ │ │ │ └── index.ts
│ │ │ │ ├── Network
│ │ │ │ │ ├── IMessageStream.ts
│ │ │ │ │ ├── MessageStream.ts
│ │ │ │ │ ├── Network.ts
│ │ │ │ │ └── index.ts
│ │ │ │ ├── Rpc
│ │ │ │ │ ├── Converter.ts
│ │ │ │ │ ├── IRpcChannel.ts
│ │ │ │ │ ├── IRpcChannelFactory.ts
│ │ │ │ │ ├── IncommingInitiatingRpcMessage.ts
│ │ │ │ │ ├── RpcCallContext.ts
│ │ │ │ │ ├── RpcChannel.ts
│ │ │ │ │ ├── RpcMessage.ts
│ │ │ │ │ ├── RpcMessageBase.ts
│ │ │ │ │ └── index.ts
│ │ │ │ └── index.ts
│ │ │ ├── Proxies
│ │ │ │ ├── CallbackStoreImpl.ts
│ │ │ │ ├── ChannelManager.ts
│ │ │ │ ├── DispatchProxy
│ │ │ │ │ ├── DispatchProxyClass.ts
│ │ │ │ │ ├── DispatchProxyClassStore.ts
│ │ │ │ │ ├── ICallInterceptor.ts
│ │ │ │ │ ├── ICallInterceptorContainer.ts
│ │ │ │ │ ├── MethodNameEnumerator.ts
│ │ │ │ │ ├── Weaver.ts
│ │ │ │ │ └── index.ts
│ │ │ │ ├── ProxyId.ts
│ │ │ │ ├── ProxySource.ts
│ │ │ │ ├── RpcRequestFactory.ts
│ │ │ │ ├── Wire.ts
│ │ │ │ └── index.ts
│ │ │ ├── ServiceId.ts
│ │ │ └── index.ts
│ │ └── index.ts
│ └── web
│ │ ├── Ipc.ts
│ │ ├── Platform.ts
│ │ ├── Transport
│ │ ├── WebSockets
│ │ │ ├── BrowserWebSocket.ts
│ │ │ ├── BrowserWebSocketAddress.ts
│ │ │ ├── BrowserWebSocketError.ts
│ │ │ ├── BrowserWebSocketLike.ts
│ │ │ ├── BrowserWebSocketLikeCtor.ts
│ │ │ └── index.ts
│ │ └── index.ts
│ │ ├── WebAddressBuilder.ts
│ │ └── index.ts
│ ├── test
│ ├── dotnet
│ │ ├── CoreIpcServer
│ │ │ ├── CoreIpcServer.ts
│ │ │ ├── DotNetProcess.ts
│ │ │ ├── InteropAddress.ts
│ │ │ ├── NonZeroExitError.ts
│ │ │ ├── NpmProcess.ts
│ │ │ ├── Paths.ts
│ │ │ ├── Signal.ts
│ │ │ └── index.ts
│ │ └── index.ts
│ ├── infrastructure
│ │ ├── MockServiceProvider.ts
│ │ ├── __.ts
│ │ ├── __members.ts
│ │ ├── __parameters.ts
│ │ ├── cover
│ │ │ ├── index.ts
│ │ │ └── internal
│ │ │ │ ├── CoverTypeContext.ts
│ │ │ │ ├── coverType.ts
│ │ │ │ ├── funky.ts
│ │ │ │ └── index.ts
│ │ ├── cover2
│ │ │ ├── Cover.ts
│ │ │ ├── funky.ts
│ │ │ └── index.ts
│ │ ├── coverOld.ts
│ │ ├── index.ts
│ │ └── overloadedParameters.ts
│ ├── node
│ │ ├── Contracts
│ │ │ ├── IAlgebra.ts
│ │ │ ├── IArithmetic.ts
│ │ │ └── index.ts
│ │ ├── Fixtures
│ │ │ └── index.ts
│ │ ├── core
│ │ │ ├── ConfigStore.test.ts
│ │ │ └── Ipc.test.ts
│ │ └── end-to-end.test.ts
│ ├── std
│ │ └── bcl
│ │ │ ├── AggregateDisposable.test.ts
│ │ │ ├── AggregateError.test.ts
│ │ │ ├── ArgumentError.test.ts
│ │ │ ├── ArgumentNullError.test.ts
│ │ │ ├── ArgumentOutOfRangeError.test.ts
│ │ │ ├── AsyncAutoResetEvent.test.ts
│ │ │ ├── CancellationToken.test.ts
│ │ │ ├── CancellationTokenSource.test.ts
│ │ │ ├── ConditionalWeakTable.test.ts
│ │ │ ├── DispatchProxyClassStore.test.ts
│ │ │ ├── PromiseCompletionSource.test.ts
│ │ │ ├── PromisePal.test.ts
│ │ │ ├── RandomCancellationToken.test.ts
│ │ │ ├── TimeSpan.test.ts
│ │ │ ├── Trace.test.ts
│ │ │ └── final-states.spec.ts
│ └── web
│ │ ├── Contracts
│ │ ├── IAlgebra.ts
│ │ ├── IArithmetic.ts
│ │ └── index.ts
│ │ ├── Fixtures
│ │ ├── AlgebraProxy.ts
│ │ ├── ProxyFactory.ts
│ │ ├── ServerUrl.ts
│ │ └── index.ts
│ │ ├── core
│ │ └── ConfigStore.test.ts
│ │ └── end-to-end.test.ts
│ ├── tsconfig.common.json
│ ├── tsconfig.dotnet.json
│ ├── tsconfig.jasmine.json
│ ├── tsconfig.json
│ ├── tsconfig.node.json
│ ├── tsconfig.test.json
│ ├── tsconfig.web-js.json
│ ├── tsconfig.web.json
│ ├── tslint.json
│ ├── webpack.common.js
│ └── webpack.dev.js
├── CoreIpc.sln
├── IpcSample.ConsoleClient
├── App1.config
├── Client.cs
├── IpcSample.ConsoleClient.csproj
├── TcpClient.cs
├── WebSocketClient.cs
└── app1.manifest
├── IpcSample.ConsoleServer
├── App1.config
├── IpcSample.ConsoleServer.csproj
├── Server.cs
├── TcpServer.cs
├── WebSocketServer.cs
└── app1.manifest
├── NuGet.Config
├── UiPath.CoreIpc.Tests
├── ComputingTests.cs
├── EndpointTests.cs
├── Implementation
│ ├── ComputingCallback.cs
│ ├── ComputingService.cs
│ ├── IpcHelpers.cs
│ ├── OneWayStreamWrapper.cs
│ └── SystemService.cs
├── NamedPipeTests.cs
├── NestedStreamTests.cs
├── SystemTests.cs
├── TcpTests..cs
├── TestBase.cs
├── UiPath.CoreIpc.Tests.csproj
├── ValidationTests.cs
└── WebSocketTests.cs
└── UiPath.CoreIpc
├── CancellationTokenSourcePool.cs
├── Client
├── ClientConnectionsRegistry.cs
├── ServiceClient.cs
└── ServiceClientBuilder.cs
├── Connection.cs
├── Dtos.cs
├── GlobalSuppressions.cs
├── Helpers.cs
├── IpcJsonSerializer.cs
├── NamedPipe
├── NamedPipeClient.cs
├── NamedPipeClientBuilder.cs
└── NamedPipeListener.cs
├── NestedStream.cs
├── Server
├── Listener.cs
├── Server.cs
├── ServerConnection.cs
├── ServiceHost.cs
└── ServiceHostBuilder.cs
├── TaskCompletionPool.cs
├── Tcp
├── TcpClient.cs
├── TcpClientBuilder.cs
└── TcpListener.cs
├── UiPath.CoreIpc.csproj
└── WebSockets
├── WebSocketClient.cs
├── WebSocketClientBuilder.cs
├── WebSocketListener.cs
└── WebSocketStream.cs
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.doc diff=astextplain
2 | *.DOC diff=astextplain
3 | *.docx diff=astextplain
4 | *.DOCX diff=astextplain
5 | *.dot diff=astextplain
6 | *.DOT diff=astextplain
7 | *.pdf diff=astextplain
8 | *.PDF diff=astextplain
9 | *.rtf diff=astextplain
10 | *.RTF diff=astextplain
11 |
12 | *.jpg binary
13 | *.png binary
14 | *.gif binary
15 |
16 | core.eol crlf
17 |
18 | *.cs diff=csharp
19 |
20 | *.csproj merge=union
21 | *.vbproj merge=union
22 | *.fsproj merge=union
23 | *.dbproj merge=union
24 | *.sln merge=union
25 | *.* linguist-detectable=false
26 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | release/
3 | scripts/
4 | artifacts/
5 | .dotnet
6 | TestResults/
7 | *.diagsession
8 | *.suo
9 | *.user
10 | bin
11 | Bin
12 | obj
13 | _ReSharper*
14 | *.csproj.user
15 | *.resharper.user
16 | *.suo
17 | *.cache
18 | TestResult.xml
19 | AppPackages/
20 | *.bak
21 | packages
22 | *.orig
23 | *.DotSettings
24 | *.ide/
25 | .nuget
26 | project.lock.json
27 | .vs
28 |
29 | # JetBrains Rider
30 | .idea/
31 | *.sln.iml
32 |
33 | # Read the Docs
34 | docs/_build
35 | /src/LastMajorVersionBinary
36 |
37 | # Mac Finder
38 | .DS_Store
39 |
--------------------------------------------------------------------------------
/DotNetTest.bat:
--------------------------------------------------------------------------------
1 | CD C:\Projects\CoreIpc\
2 | FOR /L %%G IN (0,1,10) DO (
3 | echo RUN %%G
4 | dotnet test --no-build -c Debug
5 | )
6 | PAUSE
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 UiPath
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/UiPath.Rpc/CI/azp-dotnet-dist.yaml:
--------------------------------------------------------------------------------
1 | steps:
2 | - task: CopyFiles@2
3 | displayName: '$(Label_DotNet) Copy nupkg to $(Build.ArtifactStagingDirectory)'
4 | inputs:
5 | SourceFolder: 'UiPath.Rpc\UiPath.Rpc\bin\$(DotNet_BuildConfiguration)\'
6 | Contents: '*.*nupkg'
7 | TargetFolder: '$(Build.ArtifactStagingDirectory)'
8 | CleanTargetFolder: true
9 |
10 | - task: PublishBuildArtifacts@1
11 | displayName: '$(Label_DotNet) Publish the $(DotNet_ArtifactName) to the pipeline instance'
12 | inputs:
13 | ArtifactName: '$(DotNet_ArtifactName)'
14 | PathtoPublish: '$(Build.ArtifactStagingDirectory)'
15 | ArtifactType: 'Container'
16 |
17 | - task: DotNetCoreCLI@2
18 | displayName: 'dotnet push to UiPath-Internal'
19 | condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
20 | inputs:
21 | command: push
22 | packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
23 | publishVstsFeed: 'Public.Feeds/UiPath-Internal'
24 |
25 | - task: PublishSymbols@2
26 | displayName: 'Publish Symbols to UiPath Azure Artifacts Symbol Server'
27 | condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
28 | inputs:
29 | symbolsFolder: $(Build.SourcesDirectory)
30 | searchPattern: '**/UiPath.Rpc/bin/**/UiPath.Rpc.pdb'
31 | symbolServerType: teamServices
32 | indexSources: false
--------------------------------------------------------------------------------
/UiPath.Rpc/CI/azp-dotnet.yaml:
--------------------------------------------------------------------------------
1 | steps:
2 | - task: DotNetCoreCLI@2
3 | displayName: '$(Label_DotNet) Run unit tests'
4 | inputs:
5 | command: 'test'
6 | projects: '$(DotNet_SessionSolution)'
7 | publishTestResults: true
8 | testRunTitle: '.NET tests'
9 | arguments: ' --configuration $(DotNet_BuildConfiguration) --logger "console;verbosity=detailed" -p:Version="$(FullVersion)" -p:DefineConstantsEx="CI"'
--------------------------------------------------------------------------------
/UiPath.Rpc/CI/azp-initialization.yaml:
--------------------------------------------------------------------------------
1 | steps:
2 |
3 | # Read $(Version) from the UiPath.Rpc.csproj file
4 | - powershell: |
5 | $xml = [Xml] ( Get-Content $env:DotNet_MainProjectPath )
6 | $version = [String] $xml.Project.PropertyGroup.Version
7 | $version = $version.Trim()
8 |
9 | Write-Host "##vso[task.setvariable variable=Version;]$version"
10 |
11 | displayName: '$(Label_Initialization) Read $[Version] from the csproj'
12 | env:
13 | DotNet_MainProjectPath: $(DotNet_MainProjectPath)
14 |
15 | # If $(PublishRelease) != "true" then compute $(FullVersion) as $(Version)-$(Build.BuildNumber)
16 | - task: VariableTransformTask@1
17 | displayName: '$(Label_Initialization) Compute $[FullVersion] when $[PublishRelease] is not true'
18 | inputs:
19 | value: '$(Version)-$(Build.BuildNumber)'
20 | variableName: 'FullVersion'
21 | IsSecret: false
22 | transformAction: 'none'
23 | condition: ne(variables['PublishRelease'], 'true')
24 |
25 | # If $(PublishRelease) == "true" then compute $(FullVersion) as $(Version)
26 | - task: VariableTransformTask@1
27 | displayName: '$(Label_Initialization) Compute $[FullVersion] when $[PublishRelease] is "true"'
28 | inputs:
29 | value: '$(Version)'
30 | variableName: 'FullVersion'
31 | IsSecret: false
32 | transformAction: 'none'
33 | condition: eq(variables['PublishRelease'], 'true')
34 |
--------------------------------------------------------------------------------
/UiPath.Rpc/CI/azp-start.yaml:
--------------------------------------------------------------------------------
1 | name: $(Date:yyyyMMdd)$(Rev:-rr)
2 |
3 | variables:
4 | Label_Initialization: 'Initialization:'
5 | Label_DotNet: '.NET:'
6 | Label_NodeJS: 'node.js:'
7 |
8 | DotNet_BuildConfiguration: 'Release'
9 | DotNet_SessionSolution: 'UiPath.Rpc/UiPath.Rpc.sln'
10 | DotNet_MainProjectName: 'UiPath.Rpc'
11 | DotNet_MainProjectPath: './UiPath.Rpc/UiPath.Rpc/UiPath.Rpc.csproj'
12 | DotNet_ArtifactName: 'NuGet package'
13 |
14 | NodeJS_DotNet_BuildConfiguration: 'Debug'
15 | NodeJS_ProjectPath: './src/Clients/nodejs'
16 | NodeJS_ArchivePath: './src/Clients/nodejs.zip'
17 | NodeJS_ArtifactName: 'NPM package'
18 | NodeJS_NetCoreAppTargetDir_RelativePath: 'dotnet/UiPath.Rpc.NodeInterop/bin/Debug/net6.0'
19 | NodeJS_DotNetNodeInteropProject : './src/Clients/nodejs/dotnet/UiPath.Rpc.NodeInterop/UiPath.Rpc.NodeInterop.csproj'
20 | NodeJS_DotNetNodeInteropSolution: './src/Clients/nodejs/dotnet/UiPath.Rpc.NodeInterop.sln'
21 | jobs:
22 |
23 | - job:
24 | displayName: '.NET on Windows'
25 | pool:
26 | vmImage: 'windows-latest'
27 | steps:
28 | - template: azp-initialization.yaml
29 | - template: azp-dotnet.yaml
30 | - template: azp-dotnet-dist.yaml
31 |
--------------------------------------------------------------------------------
/UiPath.Rpc/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/UiPath.Rpc/RpcSample.ConsoleClient/App1.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/UiPath.Rpc/RpcSample.ConsoleClient/RpcSample.ConsoleClient.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0-windows;net461;net7.0;
6 | app1.manifest
7 | latest
8 | true
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/UiPath.Rpc/RpcSample.ConsoleServer/App1.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/UiPath.Rpc/RpcSample.ConsoleServer/RpcSample.ConsoleServer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0-windows;net461;net7.0;
6 | app1.manifest
7 | latest
8 | true
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/UiPath.Rpc/RpcSample.ConsoleServer/Server.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 | using System.Diagnostics;
3 | using UiPath.Rpc.NamedPipe;
4 |
5 | namespace UiPath.Rpc.Tests;
6 |
7 | class Server
8 | {
9 | //private static readonly Timer _timer = new Timer(_ =>
10 | //{
11 | // Console.WriteLine("GC.Collect");
12 | // GC.Collect();
13 | // GC.WaitForPendingFinalizers();
14 | // GC.Collect();
15 | //}, null, 0, 3000);
16 | static async Task Main()
17 | {
18 | Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
19 | //GuiLikeSyncContext.Install();
20 | Console.WriteLine(SynchronizationContext.Current);
21 | var serviceProvider = ConfigureServices();
22 | // build and run service host
23 | var host = new ServiceHostBuilder(serviceProvider)
24 | .UseNamedPipes(new NamedPipeSettings("test")
25 | {
26 | RequestTimeout = TimeSpan.FromSeconds(2),
27 | //AccessControl = security => security.AllowCurrentUser(),
28 | })
29 | .AddEndpoint()
30 | .AddEndpoint()
31 | .ValidateAndBuild();
32 |
33 | await await Task.WhenAny(host.RunAsync(), Task.Run(() =>
34 | {
35 | Console.WriteLine(typeof(int).Assembly);
36 | Console.ReadLine();
37 | host.Dispose();
38 | }));
39 |
40 | Console.WriteLine("Server stopped.");
41 | }
42 |
43 | private static IServiceProvider ConfigureServices() =>
44 | new ServiceCollection()
45 | .AddRpcWithLogging()
46 | .AddSingleton()
47 | .AddSingleton()
48 | .BuildServiceProvider();
49 | }
--------------------------------------------------------------------------------
/UiPath.Rpc/RpcSample.ConsoleServer/TcpServer.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 | using System.Diagnostics;
3 | using System.Net;
4 | using UiPath.Rpc.Tcp;
5 |
6 | namespace UiPath.Rpc.Tests;
7 |
8 | class TcpServer
9 | {
10 | static readonly IPEndPoint SystemEndPoint = new(IPAddress.Any, 3131);
11 | //private static readonly Timer _timer = new Timer(_ =>
12 | //{
13 | // Console.WriteLine("GC.Collect");
14 | // GC.Collect();
15 | // GC.WaitForPendingFinalizers();
16 | // GC.Collect();
17 | //}, null, 0, 3000);
18 |
19 | static async Task _Main()
20 | {
21 | Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
22 | //GuiLikeSyncContext.Install();
23 | Console.WriteLine(SynchronizationContext.Current);
24 | var serviceProvider = ConfigureServices();
25 | // build and run service host
26 | var data = File.ReadAllBytes(@"../../../../localhost.pfx");
27 | var host = new ServiceHostBuilder(serviceProvider)
28 | .UseTcp(new TcpSettings(SystemEndPoint)
29 | {
30 | RequestTimeout = TimeSpan.FromSeconds(2),
31 | //Certificate = new X509Certificate(data, "1"),
32 | })
33 | .AddEndpoint()
34 | .AddEndpoint()
35 | .ValidateAndBuild();
36 |
37 | await await Task.WhenAny(host.RunAsync(), Task.Run(() =>
38 | {
39 | Console.WriteLine(typeof(int).Assembly);
40 | Console.ReadLine();
41 | host.Dispose();
42 | }));
43 |
44 | Console.WriteLine("Server stopped.");
45 | }
46 |
47 | private static IServiceProvider ConfigureServices() =>
48 | new ServiceCollection()
49 | .AddRpcWithLogging()
50 | .AddSingleton()
51 | .AddSingleton()
52 | .BuildServiceProvider();
53 | }
--------------------------------------------------------------------------------
/UiPath.Rpc/RpcSample.ConsoleServer/WebSocketServer.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 | using System.Diagnostics;
3 | using System.Net;
4 | using System.Net.WebSockets;
5 | using UiPath.Rpc.WebSockets;
6 | namespace UiPath.Rpc.Tests;
7 | class WebSocketServer
8 | {
9 | //private static readonly Timer _timer = new Timer(_ =>
10 | //{
11 | // Console.WriteLine("GC.Collect");
12 | // GC.Collect();
13 | // GC.WaitForPendingFinalizers();
14 | // GC.Collect();
15 | //}, null, 0, 3000);
16 |
17 | static async Task _Main()
18 | {
19 | Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
20 | //GuiLikeSyncContext.Install();
21 | Console.WriteLine(SynchronizationContext.Current);
22 | var serviceProvider = ConfigureServices();
23 | // build and run service host
24 | //var data = File.ReadAllBytes(@"../../../../localhost.pfx");
25 | var host = new ServiceHostBuilder(serviceProvider)
26 | .UseWebSockets(new(new HttpSysWebSocketsListener("http://localhost:1212/wsDemo/").Accept)
27 | {
28 | RequestTimeout = TimeSpan.FromSeconds(2),
29 | //Certificate = new X509Certificate(data, "1"),
30 | })
31 | .AddEndpoint()
32 | .AddEndpoint()
33 | .ValidateAndBuild();
34 | await await Task.WhenAny(host.RunAsync(), Task.Run(() =>
35 | {
36 | Console.WriteLine(typeof(int).Assembly);
37 | Console.ReadLine();
38 | host.Dispose();
39 | }));
40 | Console.WriteLine("Server stopped.");
41 | return;
42 | }
43 | private static IServiceProvider ConfigureServices() =>
44 | new ServiceCollection()
45 | .AddRpcWithLogging()
46 | .AddSingleton()
47 | .AddSingleton()
48 | .BuildServiceProvider();
49 | }
--------------------------------------------------------------------------------
/UiPath.Rpc/UiPath.Rpc.Tests/Implementation/ComputingCallback.cs:
--------------------------------------------------------------------------------
1 | namespace UiPath.Rpc.Tests;
2 |
3 | public interface IComputingCallback
4 | {
5 | Task GetId(Message message);
6 | Task GetThreadName();
7 | }
8 | public class ComputingCallback : IComputingCallback
9 | {
10 | public string Id { get; set; }
11 | public async Task GetId(Message message)
12 | {
13 | message.Client.ShouldBeNull();
14 | return Id;
15 | }
16 |
17 | public async Task GetThreadName() => Thread.CurrentThread.Name;
18 | }
--------------------------------------------------------------------------------
/UiPath.Rpc/UiPath.Rpc.Tests/TcpTests..cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 | using UiPath.Rpc.Tcp;
3 | namespace UiPath.Rpc.Tests;
4 | public class SystemTcpTests : SystemTests>
5 | {
6 | int _port = 3131 + GetCount();
7 | protected override ServiceHostBuilder Configure(ServiceHostBuilder serviceHostBuilder) =>
8 | serviceHostBuilder.UseTcp(Configure(new TcpSettings(GetEndPoint())));
9 | protected override TcpClientBuilder CreateSystemClientBuilder() => new(GetEndPoint());
10 | IPEndPoint GetEndPoint() => new(IPAddress.Loopback, _port);
11 | }
12 | public class ComputingTcpTests : ComputingTests>
13 | {
14 | protected readonly IPEndPoint ComputingEndPoint = new(IPAddress.Loopback, 2121+GetCount());
15 | protected override TcpClientBuilder ComputingClientBuilder(TaskScheduler taskScheduler = null) =>
16 | new TcpClientBuilder(ComputingEndPoint, _serviceProvider)
17 | .RequestTimeout(RequestTimeout)
18 | .CallbackInstance(_computingCallback)
19 | .TaskScheduler(taskScheduler);
20 | protected override ServiceHostBuilder Configure(ServiceHostBuilder serviceHostBuilder) =>
21 | serviceHostBuilder.UseTcp(Configure(new TcpSettings(ComputingEndPoint)));
22 | }
--------------------------------------------------------------------------------
/UiPath.Rpc/UiPath.Rpc.Tests/TestBase.cs:
--------------------------------------------------------------------------------
1 | using Nito.AsyncEx;
2 |
3 | namespace UiPath.Rpc.Tests;
4 |
5 | public abstract class TestBase : IDisposable
6 | {
7 | protected const int MaxReceivedMessageSizeInMegabytes = 1;
8 | protected static int Count = -1;
9 | public static readonly TimeSpan RequestTimeout =
10 | #if CI
11 | TimeSpan.FromSeconds(3) +
12 | #endif
13 | (Debugger.IsAttached ? TimeSpan.FromDays(1) : TimeSpan.FromSeconds(2));
14 | protected readonly IServiceProvider _serviceProvider;
15 | protected readonly AsyncContext _guiThread = new AsyncContextThread().Context;
16 |
17 | //static TestBase()
18 | //{
19 | // AppContext.SetSwitch("Switch.System.Net.DontEnableSystemDefaultTlsVersions", false);
20 | //}
21 | public TestBase()
22 | {
23 | _guiThread.SynchronizationContext.Send(() => Thread.CurrentThread.Name = "GuiThread");
24 | _serviceProvider = RpcHelpers.ConfigureServices();
25 | }
26 |
27 | protected static int GetCount() => Interlocked.Increment(ref Count);
28 |
29 | protected TaskScheduler GuiScheduler => _guiThread.Scheduler;
30 |
31 | public virtual void Dispose() => _guiThread.Dispose();
32 | protected virtual TSettings Configure(TSettings listenerSettings) where TSettings : ListenerSettings
33 | {
34 | listenerSettings.RequestTimeout = RequestTimeout;
35 | listenerSettings.MaxReceivedMessageSizeInMegabytes = MaxReceivedMessageSizeInMegabytes;
36 | return listenerSettings;
37 | }
38 | protected abstract ServiceHostBuilder Configure(ServiceHostBuilder serviceHostBuilder);
39 | }
--------------------------------------------------------------------------------
/UiPath.Rpc/UiPath.Rpc.Tests/UiPath.Rpc.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0;net461;net7.0-windows
5 | $(NoWarn);1998
6 | $(DefineConstants);$(DefineConstantsEx)
7 | latest
8 | true
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/UiPath.Rpc/UiPath.Rpc.Tests/WebSocketTests.cs:
--------------------------------------------------------------------------------
1 | using UiPath.Rpc.WebSockets;
2 | namespace UiPath.Rpc.Tests;
3 | public class SystemWebSocketTests : SystemTests>
4 | {
5 | int _port = 1313 + GetCount();
6 | HttpSysWebSocketsListener _listener;
7 | protected override ServiceHostBuilder Configure(ServiceHostBuilder serviceHostBuilder)
8 | {
9 | _listener = new HttpSysWebSocketsListener("http" + GetEndPoint());
10 | return serviceHostBuilder.UseWebSockets(Configure(new WebSocketSettings(_listener.Accept)));
11 | }
12 | public override void Dispose()
13 | {
14 | base.Dispose();
15 | _listener?.Dispose();
16 | }
17 | protected override WebSocketClientBuilder CreateSystemClientBuilder() => new(new("ws"+GetEndPoint()));
18 | [Fact(Skip = "WebSocket.State is unreliable")]
19 | public override Task UploadNoRead() => base.UploadNoRead();
20 | string GetEndPoint() => $"://localhost:{_port}/";
21 | }
22 | public class ComputingWebSocketsTests : ComputingTests>
23 | {
24 | protected static readonly string ComputingEndPoint = $"://localhost:{1212+GetCount()}/";
25 | HttpSysWebSocketsListener _listener;
26 | protected override WebSocketClientBuilder ComputingClientBuilder(TaskScheduler taskScheduler = null) =>
27 | new WebSocketClientBuilder(new("ws"+ComputingEndPoint), _serviceProvider)
28 | .RequestTimeout(RequestTimeout)
29 | .CallbackInstance(_computingCallback)
30 | .TaskScheduler(taskScheduler);
31 | protected override ServiceHostBuilder Configure(ServiceHostBuilder serviceHostBuilder)
32 | {
33 | _listener = new HttpSysWebSocketsListener("http" + ComputingEndPoint);
34 | return serviceHostBuilder.UseWebSockets(Configure(new WebSocketSettings(_listener.Accept)));
35 | }
36 | public override void Dispose()
37 | {
38 | base.Dispose();
39 | _listener?.Dispose();
40 | }
41 | }
--------------------------------------------------------------------------------
/UiPath.Rpc/UiPath.Rpc/CancellationTokenSourcePool.cs:
--------------------------------------------------------------------------------
1 | namespace UiPath.Rpc;
2 | // https://github.com/dotnet/aspnetcore/blob/main/src/Shared/CancellationTokenSourcePool.cs
3 | static class CancellationTokenSourcePool
4 | {
5 | public static PooledCancellationTokenSource Rent() =>
6 | #if !NET461
7 | ObjectPool.TryRent() ?? new();
8 | #else
9 | new();
10 | #endif
11 | static bool Return(PooledCancellationTokenSource cts) => ObjectPool.Return(cts);
12 | public sealed class PooledCancellationTokenSource : CancellationTokenSource
13 | {
14 | public void Return()
15 | {
16 | // If we failed to return to the pool then dispose
17 | #if !NET461
18 | if (!TryReset() || !CancellationTokenSourcePool.Return(this))
19 | #endif
20 | {
21 | Dispose();
22 | }
23 | }
24 | }
25 | }
26 | static class ObjectPool
27 | {
28 | private const int MaxQueueSize = 1024;
29 | private static readonly ConcurrentQueue Cache = new();
30 | private static int Count;
31 | public static T TryRent()
32 | {
33 | if (Cache.TryDequeue(out var pooled))
34 | {
35 | Interlocked.Decrement(ref Count);
36 | return pooled;
37 | }
38 | return pooled;
39 | }
40 | public static bool Return(T item)
41 | {
42 | if (Interlocked.Increment(ref Count) > MaxQueueSize)
43 | {
44 | Interlocked.Decrement(ref Count);
45 | return false;
46 | }
47 | Cache.Enqueue(item);
48 | return true;
49 | }
50 | }
--------------------------------------------------------------------------------
/UiPath.Rpc/UiPath.Rpc/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
1 | // This file is used by Code Analysis to maintain SuppressMessage
2 | // attributes that are applied to this project.
3 | // Project-level suppressions either have no target or are given
4 | // a specific target and scoped to a namespace, type, member, etc.
5 | using System.Diagnostics.CodeAnalysis;
6 | [assembly: SuppressMessage("Performance", "HAA0505:Initializer reference type allocation", Scope = "module")]
7 | [assembly: SuppressMessage("Performance", "HAA0502:Explicit new reference type allocation", Scope = "module")]
8 | [assembly: SuppressMessage("Performance", "HAA0501:Explicit new array type allocation", Scope = "module")]
9 | #if NET461
10 | namespace System.Runtime.CompilerServices;
11 | static class IsExternalInit
12 | {
13 | }
14 | #endif
--------------------------------------------------------------------------------
/UiPath.Rpc/UiPath.Rpc/Server/ServiceHost.cs:
--------------------------------------------------------------------------------
1 | namespace UiPath.Rpc;
2 | public sealed class ServiceHost : IDisposable
3 | {
4 | private readonly CancellationTokenSource _cancellationTokenSource = new();
5 | private readonly Listener[] _listeners;
6 | internal ServiceHost(IEnumerable listeners) => _listeners = listeners.ToArray();
7 | public void Dispose()
8 | {
9 | if(_cancellationTokenSource.IsCancellationRequested)
10 | {
11 | return;
12 | }
13 | foreach (var listener in _listeners)
14 | {
15 | listener.Dispose();
16 | }
17 | _cancellationTokenSource.Cancel();
18 | _cancellationTokenSource.AssertDisposed();
19 | }
20 | public Task RunAsync() => Task.WhenAll(Array.ConvertAll(_listeners, listener => listener.Listen(_cancellationTokenSource.Token)));
21 | }
--------------------------------------------------------------------------------
/UiPath.Rpc/UiPath.Rpc/TaskCompletionPool.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks.Sources;
2 | namespace UiPath.Rpc;
3 | static class TaskCompletionPool
4 | {
5 | public static ManualResetValueTaskSource Rent() => ObjectPool.TryRent() ?? new();
6 | static void Return(ManualResetValueTaskSource source) => ObjectPool.Return(source);
7 | public sealed class ManualResetValueTaskSource : IValueTaskSource, IValueTaskSource, IErrorCompletion
8 | {
9 | private ManualResetValueTaskSourceCore _core; // mutable struct; do not make this readonly
10 | public bool RunContinuationsAsynchronously { get => _core.RunContinuationsAsynchronously; set => _core.RunContinuationsAsynchronously = value; }
11 | public short Version => _core.Version;
12 | public ValueTask ValueTask() => new(this, Version);
13 | public void Reset() => _core.Reset();
14 | public void SetResult(T result) => _core.SetResult(result);
15 | public void SetException(Exception error) => _core.SetException(error);
16 | public void SetCanceled() => _core.SetException(new TaskCanceledException());
17 | public T GetResult(short token) => _core.GetResult(token);
18 | void IValueTaskSource.GetResult(short token) => _core.GetResult(token);
19 | public ValueTaskSourceStatus GetStatus(short token) => _core.GetStatus(token);
20 | public void OnCompleted(Action