Recommended Practices and Pitfalls - takunnma5286/EverestAPI-Document-on-Japanese GitHub Wiki

Known Issues

These are some code features and techniques that may seem useful for code mods, but that can cause various issues if used (usually related to cross-platform compatibility).

The readonly modifier can be added to struct definitions to mark them as immutable.
This crashes on MacOS for unknown reasons.

Marking individual members of a struct as readonly is fine however.

This is a hacky way to call a "base base method", for use in override methods where skipping the direct base. method call is desired. (f.e. when inheriting from a vanilla class).
This crashes on MacOS for unknown reasons.

The recommended practice is to make use of the MonoModLinkTo attribute as shown here πŸ”—

The dynamic type can be used to bypass static type checking, which is useful for accessing private types and members.
This crashes on unix because it is not supported by mono πŸ”—

Use DynamicData or Reflection πŸ”— instead.

Creating a DynamicData instance with a struct containing getters/properties will throw a System.InvalidProgramException on mono, this might be a MonoMod bug πŸ”—.

Until it gets fixed, you need to use reflection πŸ”— to access the members.

Just Don't Use Themβ„’

Tuple Deconstruction

The tuple deconstruction syntax (int a, int b) = (1, 2);, including when used to deconstruct tuples of values in loops, crashes on mono. Instead, retrieve the tuple's members individually.

⚠️ **GitHub.com Fallback** ⚠️