I suggest to create a bug report in our Issue Tracker and attach HAL code that is causing compile errors. Just looking at your code I don't see anything wrong with it so it likely should be investigated.
The register for Order Classes is common for Sales orders and Service orders. When I set an Order Class to create an Activity - it works for Sales Order, while for Service Orders - not. Is any setting...