SYSLIB diagnostics for p/invoke source generation
The following table shows the diagnostic IDs for platform-invoke (p/invoke) source-generation analyzers in .NET 7 and later versions. SYSLIB1054
automatically alerts you to places that you can use source generation to generate p/invoke marshalling code at compile time. The remaining diagnostics alert you to errors related to usage of the source generator.
Diagnostic ID | Title | Descriptions |
---|---|---|
SYSLIB1050 |
Invalid LibraryImportAttribute usage. | - Method '{0}' should be 'static', 'partial', and non-generic when marked with 'LibraryImportAttribute'. P/Invoke source generation will ignore method '{0}'. - Method '{0}' is contained in a type '{1}' that is not marked 'partial'. P/Invoke source generation will ignore method '{0}'. - The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' on method '{0}' is invalid. |
SYSLIB1051 |
The specified type is not supported by source-generated p/invokes. | - The generated source will not handle marshalling of parameter '{1}'. - The generated source will not handle marshalling of the return value of method '{1}'. |
SYSLIB1052 |
The specified configuration is not supported by source-generated p/invokes. | - The configuration is not supported by source-generated P/Invokes. If the specified configuration is required, use a regular DllImport instead.- The specified configuration for parameter '{1}' is not supported by source-generated P/Invokes. - The specified configuration for the return value of method '{1}' is not supported by source-generated P/Invokes. - The specified value for '{1}' is not supported by source-generated P/Invokes. - The specified marshalling configuration is not supported by source-generated P/Invokes. |
SYSLIB1053 |
The specified LibraryImportAttribute arguments cannot be forwarded to DllImportAttribute. | '{0}' has no equivalent in 'DllImportAtttribute' and will not be forwarded. |
SYSLIB1054 |
Use LibraryImportAttribute instead of DllImportAttribute to generate p/invoke marshalling code at compile time. | |
SYSLIB1055 |
Invalid CustomMarshallerAttribute usage. | |
SYSLIB1056 |
The specified native type is invalid. | |
SYSLIB1057 |
The marshaller type does not have the required shape. | |
SYSLIB1058 |
Invalid NativeMarshallingAttribute usage. | |
SYSLIB1059 |
The marshaller type does not support an allocating constructor. | |
SYSLIB1060 |
The specified marshaller type is invalid. | |
SYSLIB1061 |
The marshaller type has incompatible method signatures. | |
SYSLIB1062 |
The project must be updated with <AllowUnsafeBlocks>true</AllowUnsafeBlocks> . |
For more information about source generation for p/invoke, see Source generation for platform invokes and Tutorial: Use custom marshallers in source-generated P/Invokes.
See also
GitHub पर हमारे साथ सहयोग करें
इस सामग्री का स्रोत GitHub पर पाया जा सकता है, जहाँ आप समस्याएँ बना और समीक्षा भी कर सकते हैं और अनुरोध खींच सकते हैं. अधिक जानकारी के लिए, हमारे योगदानकर्ता गाइड देखें.