Author C# components
Reference the shared SDK, export supported members and respect host-owned lifetime.
Use the toolchain’s dependency contract#
C# authoring requires a development checkout with the SDK and managed toolchain, or an explicitly supplied matching SDK assembly. The application installer is not assumed to install a global dotnet or mcbasic command. The repository’s central package versions are authoritative for its samples; do not choose an unrelated Avalonia version by guesswork.
Start with a component whose lifecycle is observable#
The LifecycleProbe sample records initialization, activation, cancellation, deactivation and disposal. It intentionally asks whether a missing logical resource is rejected. That makes host ownership observable before adding complex UI behavior.
Follow the C# component walkthrough, then inspect the public contract reference when adding properties, methods or events.
Export only the supported API#
Apply McComponent to the public class and the member attributes to the API you want BASIC consumers to use. Keep names, defaults, read-only flags and asynchronous behavior explicit. A public CLR method without an exported supported contract is not automatically a BASIC API.
Keep Designer inspection passive#
Metadata inspection and Toolbox preview must not run arbitrary component initialization. Runtime work belongs in the generated application’s lifecycle. Use Resources for declared read-only assets and Lifetime for cancellation. SDK 1.0 exposes no sensitive host service and requires an empty capabilities array.
Test each boundary#
Compile, package, verify static admission, compare rebuild inventories, then run an owned consumer through runtime-check. Inspect each command’s reported gate. A successful package archive alone does not certify native interaction, deployment or every supported target.
20f4bfed6b · Build manifest