The following caveats apply to all callback registrations:
RapidCode does not take ownership of your callback. The GcodeCallback you register must be kept alive throughout all loading and execution of G-Code, or else behavior is undefined. In C#, retain a strong reference to avoid garbage collection.
Registering or unregistering a callback will require you to re-load your G-Code before any calls to Gcode::Run().