Description
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:
- Support treating all unmanaged types as blittable if the attribute is present on a module Implement System.Runtime.CompilerServices.DisabledRuntimeMarshallingAttribute on CoreCLR-family of runtimes/type systems #63320
- Move the legacy marshalling support code into a mono component [MONO] Move marshal-ilgen into a component #71203
- Marshalling code has been refactored into marshal-lightweight (which must remain in the runtime) and marshal-ilgen (which has been moved to a component).
- Enable tooling to drop the component (WASM)
- Enable tooling to drop the component (iOS)
- Enable tooling to drop the component (Android)
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.
Metadata
Metadata
Assignees
Type
Projects
Status