Skip to content

EN CSharp Runtime

Codex edited this page Oct 11, 2026 · 2 revisions

Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

C#-script engine

The source code compiles Roslyn. The compiled script executes the usual .NET 10/CoreCLR.

A static field belongs to its type and is shared by its instances within one execution. Each run of .csx, .cs or .csproj isolates user-defined types and their static fields; caching compiled code does not preserve those fields across runs. Static data in shared .NET and host libraries remains shared: keep character-specific data out of it.

Cancellation checkpoints are added to controlled statements and loops. They do not roll back actions that already occurred. finally blocks retain resource cleanup. Third-party blocking calls need their own cancellation support. Use WaitAsync for script waits and pass Cancellation to asynchronous operations that accept a token.

Dynamically compiled scripts have the capabilities of regular .NET code. File and game API permissions are determined by the local process and the selected session.

The cancellation request is cooperative. Task.Delay without Cancellation transfer, waiting for third-party task and library call without cancel support can continue after pressing Stop. Once a cancellation request is made, further gaming activities of that execution are prohibited; this does not force any .NET code to terminate immediately.

Clone this wiki locally