Provide an analyzer to detect incorrect function pointer invocation when marshaling is disabled #234
Labels
Area-CodeAnalysis
Issues concerning a C# code analysis.
Concept-OutputFriendliness
Issues concerning the friendliness of using the Biohazrd output
Concept-OutputUsability
Issues concerning whether or not the output from Biohazrd is actually usable
Language-C#
Issues specific to C#
Relates to #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.
The text was updated successfully, but these errors were encountered: