Class AppHost<TApp>
A RDCore.SDK application host.
public abstract class AppHost<TApp> : IDisposable where TApp : class, IRDCoreApp
Type Parameters
TAppThe type of IRDCoreApp being hosted.
- Inheritance
-
AppHost<TApp>
- Implements
- Derived
-
RDCoreLanguageClientHost<TApp>RDCoreLanguageServerHost<TApp>
- 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
Properties
ExitCode
Gets the application's exit code.
public virtual int ExitCode { get; }
Property Value
Info
Gets the AssemblyName of this application.
public static AssemblyName Info { get; }
Property Value
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
providerIServiceProviderThe constructed service provider.
Returns
Configure(IConfiguration, IServiceCollection, string[])
Override to supply application-specific IConfiguration configuration.
protected virtual void Configure(IConfiguration configuration, IServiceCollection services, string[] args)
Parameters
configurationIConfigurationservicesIServiceCollectionargsstring[]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
servicesIServiceCollectionThe service provider of the application host being configured.
configurationIConfigurationThe 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
servicesIServiceCollectionThe service provider of the application host being configured.
builderILoggingBuilderThe ILoggingBuilder to configure logging providers.
configurationIConfigurationThe 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
Debuglogger 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
servicesIServiceCollectionThe service provider of the application host being configured.
configurationIConfigurationThe 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
disposingbool
Remarks
⚠️ Overrides MUST invoke the base.Dispose(bool) base implementation.
LogIfEnabled(LogLevel, string)
public void LogIfEnabled(LogLevel logLevel, string message)
Parameters
RunAsync(string[])
Runs the RDCore.SDK client/server application.
public Task<int> RunAsync(string[] args)
Parameters
argsstring[]
Returns
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.