Closed
Description
Issues to address/consider after ship-ready work (#60212):
APIs:
- LibraryImportAttribute for p/invoke source generation #46822
- Attributes and Analyzer Diagnostics to support custom struct marshalling in the DllImport Source Generator #46838
- [API Proposal]: Specify supported custom type marshalling features on CustomTypeMarshallerAttribute #66121
- [API Proposal]: Implementations of marshallers using
CustomTypeMarshallerAttribute
#66623
Reconciliation of blittable/unmanaged:
- [API Proposal]: System.Runtime.CompilerServices.RuntimeCompatibilityAttribute.DisableRuntimeMarshalling #60639
- Update design doc for user-defined type marshalling with the new
DisableRuntimeMarshallingAttribute
- Update source generator for
DisableRuntimeMarshallingAttribute
and reconciled unmanaged/blittable- Source generator treats unmanaged as not requiring marshaling
- Add marshalling info (
NativeMarshalling
orMarshalUsing
) for types in runtime libraries that need it - Runtime libraries use
DisableRuntimeMarshallingAttribute
- Convert p/invokes using affected types to GeneratedDllImport - known p/invokes are marked
// TODO: [DllImportGenerator]
and#pragma warning disable DLLIMPORTGENANALYZER015
- Code fix to add DisableRuntimeMarshalling when required #67676
Custom marshallers:
- Add marshaller types to runtime libraries
Release:
- Update diagnostics to match convention/prefix for runtime libraries
- Use `SYSLIB1###' IDs and update doc
- Update p/invoke source generator errors to use SYSLIB prefix #65983
- Localization - Enable localization for LibraryImportGenerator #67107
- Include
DllImportGenerator
in NETCoreApp ref-pack - Apply GeneratedCodeAttribute Interop source generator should insert [GeneratedCodeAttribute] #64562
- Enable trimming of attributes used for generation
Fixer:
A code fixer should be provided to help with the conversion to using generated p/invokes via the new attribute. We may not support all options based on added complexity versus usage.
- Basic conversion to new attribute where all options specified on DllImport are supported by source generator
PreserveSig
: change managed signature to returnint
and have anout
param if necessary, add custom marshaller for return value to throw if necessary, update callers,ExactSpelling
: different fix option to append suffix onEntryPoint
property- Add stubbed out implementation for custom marshallers
Issues:
- [DllImportGenerator] "MarshalUsing" ignores "ref" return type runtimelab#1650
- [DllImportGenerator] ICustomMarshaler ~support runtimelab#963
- Pin stage only accepts FixedStatementSyntaxes runtimelab#1653
- DllImportGenerator conversion code fix should make the containing types partial #62291
- DllImportGenerator should error if attribute is applied to an extern #62700
- [DllImportGenerator] Remove DLLIMPORTGENERATOR_ENABLED define option #63464
- [DllImportGenerator]
DefaultDllImportSearchPathsAttribute
should be forwarded to local p/invoke #65154