Class WindowsSandbox
Windows sandbox using Job Objects for resource limits and Restricted Tokens for capability stripping. Requires Windows Vista or later. No third-party dependencies.
public sealed class WindowsSandbox : ISandbox
- Inheritance
-
WindowsSandbox
- Implements
- Inherited Members
Constructors
WindowsSandbox(SandboxPolicy)
public WindowsSandbox(SandboxPolicy policy)
Parameters
policySandboxPolicy
Properties
Platform
Which platform this sandbox targets.
public SandboxPlatform Platform { get; }
Property Value
Policy
The policy this sandbox enforces.
public SandboxPolicy Policy { get; }
Property Value
Methods
RunAsync(string, string, CancellationToken)
Runs the sandboxed process to completion and returns the result.
public Task<SandboxExecutionResult> RunAsync(string executablePath, string arguments = "", CancellationToken ct = default)
Parameters
executablePathstringargumentsstringctCancellationToken
Returns
StartAsync(string, string, CancellationToken)
Starts a new sandboxed process using the configured policy.
public Task<SandboxedProcess> StartAsync(string executablePath, string arguments = "", CancellationToken ct = default)
Parameters
executablePathstringPath to the executable to run.
argumentsstringCommand-line arguments.
ctCancellationTokenCancellation token.
Returns
- Task<SandboxedProcess>
A handle to the running sandboxed process.