Table of Contents

Language subset diagnostics (GBS0001–GBS0099)

Constructs outside the GB# language subset. These are errors by design: lowering answers "I cannot represent this" by stopping the build.

GBS0001: Unsupported construct

Severity: Error · Suppressible: no

{0} is not supported in GB#.

GB# supports a subset of C# that lowers predictably to an 8-bit target. See the GB# language reference for the supported constructs.

GBS0002: Unsupported type

Severity: Error · Suppressible: no · Shown live in the IDE

Type '{0}' is not supported in GB#.

GB# supports byte, sbyte, ushort, short, bool, enums, structs and fixed-size arrays.

GBS0003: No entry point

Severity: Error · Suppressible: no

No entry point found.

GB# needs one 'public static void Main()' method with no parameters.

GBS0004: Multiple entry points

Severity: Error · Suppressible: no

Found {0} candidate entry points; GB# needs exactly one.

Remove or rename the extra 'static void Main()' methods.

GBS0005: Call cannot be lowered

Severity: Error · Suppressible: no

'{0}' has no body in this compilation and is not marked [Native].

GB# can only call methods it can see the source of, or methods mapped to a C symbol with [Native("symbol")].

GBS0007: 32-bit arithmetic

Severity: Performance · Suppressible: no · Shown live in the IDE

'{0}' requires 32-bit arithmetic on SM83.

Consider ushort if values cannot exceed 65,535, or byte if they cannot exceed 255.

GBS0042: Dynamic collection

Severity: Error · Suppressible: no · Shown live in the IDE

{0} requires dynamic allocation.

Use FixedList<T, N> or FixedArray<T, N> instead. Capacity stays visible in the source, and the storage is reserved at compile time.

GBS0043: System.String is unavailable

Severity: Error · Suppressible: no · Shown live in the IDE

System.String requires heap allocation and is not available in GB#.

Use a fixed byte array for text, and the tile-based text APIs to draw it.

GBS0044: Exceptions are unavailable

Severity: Error · Suppressible: no · Shown live in the IDE

Exception handling is not supported in GB#.

There is no unwinding machinery on the target. Return a status value instead.

GBS0045: Delegates and events are unavailable

Severity: Error · Suppressible: no · Shown live in the IDE

{0} requires runtime dispatch and is not supported in GB#.

Call the target directly, or switch on an enum to choose between behaviours.

GBS0046: Interfaces are unavailable

Severity: Error · Suppressible: no · Shown live in the IDE

Interface '{0}' requires virtual dispatch and is not supported in GB#.

Use a struct with an enum tag and a switch, which lowers to a jump the developer can see.

GBS0047: async/await is unavailable

Severity: Error · Suppressible: no · Shown live in the IDE

'async' and 'await' are not supported in GB#.

There is no scheduler on the target. Drive work from the frame loop instead.

GBS0048: Boxing

Severity: Error · Suppressible: no

Converting '{0}' to '{1}' boxes the value onto a heap GB# does not have.

Keep the value in its own type. GB# has no object header and no allocator.

GBS0049: LINQ is unavailable

Severity: Error · Suppressible: no · Shown live in the IDE

LINQ is not supported in GB#.

Write the loop. On an 8-bit CPU the loop is what you want to be able to read anyway.

GBS0050: Reference type allocation

Severity: Error · Suppressible: no · Shown live in the IDE

Allocating '{0}' requires a heap GB# does not have.

Declare it as a struct, or make the type static if it holds no per-instance state.

GBS0051: Unsupported operator

Severity: Error · Suppressible: no

Operator '{0}' is not supported in GB#.

GBS0052: Array size must be constant

Severity: Error · Suppressible: no

The length of '{0}' must be a compile-time constant.

GB# reserves array storage at compile time, so the length has to be known then.

GBS0053: Invalid [Native] declaration

Severity: Error · Suppressible: no

[Native] member '{0}' is invalid: {1}

GBS0054: Capacity required

Severity: Error · Suppressible: no

'{0}' needs a [Capacity(n)] attribute on its declaration.

GB# reserves the storage at compile time, so the capacity has to be written where the collection is declared. For example: [Capacity(8)] static FixedList<Enemy> enemies;

GBS0055: Invalid capacity

Severity: Error · Suppressible: no

Capacity {0} on '{1}' is out of range.

A fixed collection must hold between 1 and 255 items.

GBS0056: Write to read-only data

Severity: Error · Suppressible: no

'{0}' is read-only data in ROM and cannot be assigned.

A cartridge cannot be written to. Copy the value into a mutable array or a local if it has to change while the game runs, or drop 'readonly' to move the whole array into WRAM and pay for it there.

GBS0057: Initializer is not constant

Severity: Error · Suppressible: no

Element {0} of '{1}' is not a compile-time constant.

GB# writes static data into the ROM image at build time, so every element has to be known then. Assign the value in Main if it can only be computed at runtime.

GBS0058: Recursive call

Severity: Warning · Suppressible: yes

'{0}' is part of a recursive call cycle: {1}.

SM83 has no stack limit check. The stack starts at the top of work RAM and grows down through the same 8 KB the static fields grow up through, so a recursion that goes one level too deep overwrites them: the failure looks like a variable changing value on its own rather than like a crash. This is also why GB# reports no call depth for this program, since the depth is whatever the data makes it. Rewriting the recursion as a loop over a FixedList is the usual fix.

GBS0059: Constructor needs somewhere to construct

Severity: Error · Suppressible: no

A '{0}' constructor cannot be used here.

A GB# constructor writes through a pointer to storage that already exists, so it needs a variable to fill. Assign it to one first - 'Point p = new Point(3, 4);' or 'p = new Point(3, 4);' - and pass that. Constructing straight into an argument or a return would need a temporary GB# invented, which is stack the developer cannot see.