Biohazrd
Biohazrd copied to clipboard
Provide an analyzer to detect incorrect function pointer invocation when marshaling is disabled
Relates to https://github.com/MochiLibraries/Biohazrd/issues/233
Having marshaling disabled introduces an awkward situation for function pointers which cross assembly bounds. If a function pointer from a no-marshaling assembly is invoked from a legacy yes-marshaling assembly the invocation may fail at runtime.
In order to guide Mochi consumers to correct behavior we should introduce an analyzer to detect bad situations and warn developers that they either need to apply DisableRuntimeMarshalling
or use some other sort of workaround.
In the simplest form, this would be an analyzer which warns when a yes-marshaling assembly references a no-marshaling assembly.
In a more complex form it would check if a yes-marshaling assembly accesses a function pointer from a no-marshaling assembly.