lmcode-csharp-sample skill

Use lmcode-csharp-sample as a verified blueprint for embedding lmcode-csharp (vendor/lmcode-csharp) in a C# (.NET 8) host application with schema discovery, R49 rule entries, dry mode, and LMCODE_RETURN framing.

Purpose

Demonstrate a complete, byte-pinned C# (.NET 8) host application that exposes a 45-signature Shop/Ledger domain to DSLB v6 bytecode and passes the shared sample suite.

When to use it

Use lmcode-csharp-sample when learning how to bind C# (.NET 8) domain objects, overloaded methods, operators, R49 rule entries, and LMCODE_RETURN result envelopes with lmcode-csharp (vendor/lmcode-csharp).

Install

Clone lmctl-ai/lmcode-csharp-sample and run ./test.sh with C# (.NET 8), Python 3, Node 24, and a DSLB v6 capable lmscript compiler (set LMSCRIPT_BIN to select one).

Commands

git clone https://github.com/lmctl-ai/lmcode-csharp-sample.git
cd lmcode-csharp-sample
python3 scripts/sync.py check
./test.sh
dotnet run --project src/LmCode.Sample.csproj -- --version
dotnet run --project src/LmCode.Sample.csproj -- --lmcode-schema --json
dotnet run --project src/LmCode.Sample.csproj -- --lmcode-signatures
dotnet run --project src/LmCode.Sample.csproj -- --lmcode sample-suite/bytecode/001-literals.dslb

Inputs and outputs

Safety rules

Worked examples

prog = _lmcode_ cli="lmcode-csharp-sample" install="github:lmctl-ai/lmcode-csharp-sample@latest";
  ledger.record(shop.total());
end _lmcode_
r = run_lmcode(prog);

Errors and exit codes

CodePhaseExitCondition
LOAD_BAD_BYTECODEload3Malformed DSLB v6 header, bad magic or version, truncated section, invalid opcode, or stack depth violation
LOAD_BAD_SCHEMAload3Host schema JSON fails dsl.schema 2 validation or declares an invalid result contract
LOAD_SCHEMA_MISMATCHload332-byte SHA-256 schema hash in DSLB v6 header does not match exact host schema bytes
LOAD_UNBOUNDload3Bytecode imports a context, function, or method signature not registered in the host Registry
RUN_ERRORrun3VM runtime error such as division or remainder by zero
RUN_HOSTrun3Host callback failure, invalid encoding, or expired collection handle
APP_FAILapp4Post-run application domain validation failure or output stream write failure

How to verify

./test.sh