PipeCall 0.0.2
dotnet add package PipeCall --version 0.0.2
NuGet\Install-Package PipeCall -Version 0.0.2
<PackageReference Include="PipeCall" Version="0.0.2" />
paket add PipeCall --version 0.0.2
#r "nuget: PipeCall, 0.0.2"
// Install PipeCall as a Cake Addin #addin nuget:?package=PipeCall&version=0.0.2 // Install PipeCall as a Cake Tool #tool nuget:?package=PipeCall&version=0.0.2
PipeCall - Cross-Process Method Invocation Library
PipeCall is an AI-generated lightweight, high-performance library for executing .NET methods across process boundaries. It uses anonymous pipes for communication and a custom binary serializer for efficient data transfer.
A major use of PipeCall is to call .net framework methods from a >.net5 app. For exmaple, System.IO.Ports are broken >.net5 but good in .netfx48. Another use is to prevent some flawed library from crashing the main program, so a seperated process would be useful.
Features
- Execute methods in a separate process with type safety
- Efficient binary serialization
- Support for primitive types, strings, arrays, and structs
- No external dependencies
- Clean process cleanup and resource management
Example
Here's a minimal example showing how to use PipeCall:
// Define your interface/abstract class, you can put into a common dll.
public abstract class MyDelegate : ProcessDelegate
{
protected MyDelegate() { } // Protected constructor
public abstract int Add(int a, int b);
public abstract string Concatenate(string[] strings);
}
// Implement the actual delegate in client.exe
public class ActualDelegate : MyDelegate
{
public override int Add(int a, int b)
{
Console.WriteLine($"Adding {a} + {b}");
return a + b;
}
public override string Concatenate(string[] strings)
{
var result = string.Join(" ", strings);
Console.WriteLine($"Concatenating: {result}");
return result;
}
}
// Boilerplate code for client.exe
class ProgramClient{
static void Main(string[] args){
PipeCallee.DelegateProcessMain<ActualDelegate>(args);
}
}
// Use it in your main program, like server.exe
class Program
{
static void Main()
{
// Start the delegate in a new process
var del = PipeCaller<MyDelegate>.Start("client.exe");
// Call methods as if they were local
int sum = del.Add(5, 3);
Console.WriteLine($"Result: {sum}"); // Output: Result: 8
string concat = del.Concatenate(new[] { "Hello", "World" });
Console.WriteLine($"Result: {concat}"); // Output: Result: Hello World
}
}
How It Works
- You define an abstract class inheriting from
ProcessDelegate
with your desired methods - Implement the actual delegate class with your business logic, and start client program with
PipeCallee.DelegateProcessMain<TActual>(args)
. - Use
PipeCaller<T>.Start()
to create a proxy in a new process - Call methods on the proxy as if they were local - PipeCall handles all the IPC
Features in Detail
- Process Isolation: Methods execute in a separate process, providing isolation and stability
- Efficient Serialization: Custom binary serializer for high-performance data transfer
- Type Safety: Full compile-time type checking
- Resource Management: Automatic cleanup of processes and handles
- Error Handling: Proper propagation of exceptions across process boundaries
Supported Types
- Primitives (int, float, etc.)
- Strings
- Arrays
- Structs
- Null values
- Complex combinations (arrays of structs, etc.)
Best Practices
- Keep method arguments and return values serializable
- Prefer simple data types for better performance
- Handle exceptions appropriately
- Dispose of delegates when done (they'll clean up the child process)
Why "PipeCall"?
PipeCall is named after the mechanism it uses—anonymous pipes—to facilitate communication between processes. Just as pipes transport water, PipeCall transports method calls and data, enabling seamless cross-process execution.
License
MIT License - Feel free to use in your projects!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.Reflection.Emit (>= 4.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.