Table of Contents

Class AppHost<TApp>

Namespace
RDCore.SDK.Server
Assembly
RDCore.SDK.dll

A RDCore.SDK application host.

public abstract class AppHost<TApp> : IDisposable where TApp : class, IRDCoreApp

Type Parameters

TApp

The type of IRDCoreApp being hosted.

Inheritance
AppHost<TApp>
Implements
Derived
Inherited Members

Remarks

👉 This class is inherited by both RDCoreLanguageServerHost<TApp> and RDCoreLanguageClientHost<TApp> to encapsulate a common interface to simplify implementing any kind of SDK application.

Constructors

AppHost()

A RDCore.SDK application host.

protected AppHost()

Remarks

👉 This class is inherited by both RDCoreLanguageServerHost<TApp> and RDCoreLanguageClientHost<TApp> to encapsulate a common interface to simplify implementing any kind of SDK application.

Fields

ProcessTokenSource

protected readonly CancellationTokenSource ProcessTokenSource

Field Value

CancellationTokenSource

Properties

ExitCode

Gets the application's exit code.

public virtual int ExitCode { get; }

Property Value

int

Info

Gets the AssemblyName of this application.

public static AssemblyName Info { get; }

Property Value

AssemblyName

Remarks

👉 This provides the Name and Version values for both ServerInfo and ClientInfo unless the application overrides this default.

Methods

BeforeAppStartAsync(IServiceProvider)

🧩 A method that runs after configuration but before the application is resolved and actually started.
Base implementation returns a CompletedTask

protected virtual Task BeforeAppStartAsync(IServiceProvider provider)

Parameters

provider IServiceProvider

The constructed service provider.

Returns

Task

Configure(IConfiguration, IServiceCollection, string[])

Override to supply application-specific IConfiguration configuration.

protected virtual void Configure(IConfiguration configuration, IServiceCollection services, string[] args)

Parameters

configuration IConfiguration
services IServiceCollection
args string[]

Any command-line arguments that were supplied to the application, parsed into SdkAppOptions.

Remarks

🧩 The base implementation binds and configures appsettings.json options, with command-line arguments as overrides.

ConfigureAdditionalExternalServices(IServiceCollection, IConfiguration)

Configures any additional services that must be injected in the application constructor.
🧩 The base implementation does nothing.

protected virtual void ConfigureAdditionalExternalServices(IServiceCollection services, IConfiguration configuration)

Parameters

services IServiceCollection

The service provider of the application host being configured.

configuration IConfiguration

The current application configuration.

Remarks

👉 The purpose of external services is to bootstrap the application and support functionality at the entry point level by registering the services that must be injected in the IRDCoreApp application.

ConfigureExternalLogging(IServiceCollection, ILoggingBuilder, IConfiguration)

Configures the external service provider logging targets for a RDCore.SDK client/server application.

protected virtual void ConfigureExternalLogging(IServiceCollection services, ILoggingBuilder builder, IConfiguration configuration)

Parameters

services IServiceCollection

The service provider of the application host being configured.

builder ILoggingBuilder

The ILoggingBuilder to configure logging providers.

configuration IConfiguration

The current application configuration.

Remarks

👉 The external services are not registered with the OmniSharp language server host.
Their purpose is to bootstrap the application and support functionality at the entry point level by registering the services that must be injected in the IRDCoreApp application.

🧩 The default/base implementation:

  • Sets the effective minimum log level as per the supplied TraceLevel.
  • Adds a Debug logger in debug builds.

ConfigureExternalServices(IServiceCollection, IConfiguration)

Configures only the services needed to resolve the IRDCoreApp instance.

protected virtual void ConfigureExternalServices(IServiceCollection services, IConfiguration configuration)

Parameters

services IServiceCollection

The service provider of the application host being configured.

configuration IConfiguration

The current application configuration.

Remarks

🧩 If you don't intend to overwrite the core service registrations, you probably want to override ConfigureAdditionalExternalServices(IServiceCollection, IConfiguration) instead.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

The standard .NET Dispose Pattern. Override to cleanly dispose of any instance-level IDisposable references.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

Remarks

⚠️ Overrides MUST invoke the base.Dispose(bool) base implementation.

LogIfEnabled(LogLevel, string)

public void LogIfEnabled(LogLevel logLevel, string message)

Parameters

logLevel LogLevel
message string

RunAsync(string[])

Runs the RDCore.SDK client/server application.

public Task<int> RunAsync(string[] args)

Parameters

args string[]

Returns

Task<int>

Remarks

RDCore.SDK plugins should await this method inside a try...catch block in the application's entry point (Program.cs) to block execution until the internal Omnisharp LSPserver exits.

Exceptions

OperationCanceledException

Signals a normal exit; host application process should exit with code 0.

Exception

Any other exception type is unexpected and if it is fatal, the host application process should exit with a non-zero error code.