The DisableRuntimeMarshallingAttribute is added to a module to indicate that it should:
- Consider all unmanaged types as blittable
- Promise that the current assembly does not need the default runtime marshaling behavior (that is responsible for converting strings between encodings, supporting SafeHandle, etc, etc). The idea is that a DllImportGenerator is used to generate those kinds of wrappers, and the runtime is only responsible for dealing with primitive types.
For mono that means:
We can drop the component if every single assembly meets one of these criteria:
* Is also tagged with the DisableRuntimeMarshalingAttribute.
* Uses only PInvokes with blitable types
Tooling consists of the RuntimeMarhsalingScannner which scans assemblies for these criteria.
The user sets RuntimeMarshaling to one of three values: Auto, Disable, and Enable. Auto uses the RuntimeMarshalingScanner to scan all assemblies, and drops the component if all assemblies meet the criteria. Disable forces disabling of runtime marshaling, and the SDK will emit warnings for incompatible assemblies. Enable preserves runtime marshaling, regardless of the results of the RuntimeMarshalingScanner.
Implementation plan:
- First pass implements the scanner, but this can only implement warnings on an assembly eevel
- Platform order: wasm, iOS, android
- Second version uses source analyzer for better errors.
The
DisableRuntimeMarshallingAttributeis added to a module to indicate that it should:For mono that means:
We can drop the component if every single assembly meets one of these criteria:
* Is also tagged with the
DisableRuntimeMarshalingAttribute.* Uses only PInvokes with blitable types
Tooling consists of the
RuntimeMarhsalingScannnerwhich scans assemblies for these criteria.The user sets
RuntimeMarshalingto one of three values:Auto,Disable, andEnable.Autouses theRuntimeMarshalingScannerto scan all assemblies, and drops the component if all assemblies meet the criteria.Disableforces disabling of runtime marshaling, and the SDK will emit warnings for incompatible assemblies.Enablepreserves runtime marshaling, regardless of the results of theRuntimeMarshalingScanner.Implementation plan: