Debug Class Transformation Issues
Identifying Transformation Problems
When your custom class transformer isn't working as expected, systematic debugging helps isolate the issue. SpASM processes classes early in the loading chain, so problems may not be immediately obvious.
Troubleshooting Approach
1. Check your transformer is registered by verifying the spasm:transformer entrypoint entry exists and points to the correct class.
2. Add logging to your transformer to confirm it's being called. Log which classes are being processed and what modifications are attempted.
3. Validate bytecode output by ensuring your transformer returns valid, modified bytecode. Invalid bytecode will cause silent failures or crashes during class loading.
4. Test with a simple transformation first before implementing complex logic. Start with a minimal change to verify the registration and execution pipeline works.
5. Review class availability — ensure target classes exist in the game version you're testing. Class names and structures change between versions.
6. Check mod load order if using multiple mods with transformers. SpASM processes transformers in registration order, which may affect results.