CancelEventHandler/CancelEventArgs on C#

There are very good uses for CancelEventHandler/CancelEventArgs on FiveM, like preventing menus and other UI Items from being closed on specific actions, a good example is a spawn menu being closed before selecting an option.

I tried to use them on FiveM but got a System.TypeLoadException. Later someone told me on the FiveM Discord server that they were not available and removing them made the exception go away.

Current Mono build is a massive mess to make reproducible/add additional BCL types to, rather suggested to provide your own equivalent for these types especially given how simple they are to replicate in your own code.

This kind of stuff is on the very-far-away backlog since it’d lead to a massive amount of potential incompatibilities to port the current ‘restricted API set’ to newer Mono versions, and the alternative (not restricting but using an OS-level sandbox) is much much much more complicated and would require nearly rewriting large portions of all target games we allow…

Oh well, I wanted to avoid reinventing the wheel. Thanks for answering!