diff --git a/DllImportGenerator/DllImportGenerator/GeneratorDiagnostics.cs b/DllImportGenerator/DllImportGenerator/GeneratorDiagnostics.cs
index 5ac6973b800..e3f7a39a954 100644
--- a/DllImportGenerator/DllImportGenerator/GeneratorDiagnostics.cs
+++ b/DllImportGenerator/DllImportGenerator/GeneratorDiagnostics.cs
@@ -43,6 +43,9 @@ public static Diagnostic CreateDiagnostic(
}
}
+ ///
+ /// Class for reporting diagnostics in the DLL import generator
+ ///
public class GeneratorDiagnostics
{
private class Ids
@@ -121,6 +124,12 @@ public GeneratorDiagnostics(GeneratorExecutionContext context)
this.context = context;
}
+ ///
+ /// Report diagnostic for configuration that is not supported by the DLL import source generator
+ ///
+ /// Attribute specifying the unsupported configuration
+ /// Name of the configuration
+ /// [Optiona] Unsupported configuration value
public void ReportConfigurationNotSupported(
AttributeData attributeData,
string configurationName,
@@ -143,6 +152,11 @@ public void ReportConfigurationNotSupported(
}
}
+ ///
+ /// Report diagnostic for marshalling of a parameter/return that is not supported
+ ///
+ /// Method with the parameter/return
+ /// Type info for the parameter/return
internal void ReportMarshallingNotSupported(
IMethodSymbol method,
TypePositionInfo info)
diff --git a/DllImportGenerator/DllImportGenerator/Resources.Designer.cs b/DllImportGenerator/DllImportGenerator/Resources.Designer.cs
index dd85e66f82c..67f0b5f785e 100644
--- a/DllImportGenerator/DllImportGenerator/Resources.Designer.cs
+++ b/DllImportGenerator/DllImportGenerator/Resources.Designer.cs
@@ -70,7 +70,7 @@ internal static string BlittableTypeMustBeBlittableDescription {
}
///
- /// Looks up a localized string similar to Type '{0}' is marked with 'BlittableTypeAttribute' but is not blittable..
+ /// Looks up a localized string similar to Type '{0}' is marked with 'BlittableTypeAttribute' but is not blittable.
///
internal static string BlittableTypeMustBeBlittableMessage {
get {
@@ -160,7 +160,7 @@ internal static string GetPinnableReferenceReturnTypeBlittableDescription {
}
///
- /// Looks up a localized string similar to The dereferenced type of the return type of the 'GetPinnableReference' method must be blittable..
+ /// Looks up a localized string similar to The dereferenced type of the return type of the 'GetPinnableReference' method must be blittable.
///
internal static string GetPinnableReferenceReturnTypeBlittableMessage {
get {
@@ -178,7 +178,7 @@ internal static string GetPinnableReferenceShouldSupportAllocatingMarshallingFal
}
///
- /// Looks up a localized string similar to Type '{0}' has a 'GetPinnableReference' method but its native type does not support marshalling in scenarios where pinning is impossible..
+ /// Looks up a localized string similar to Type '{0}' has a 'GetPinnableReference' method but its native type does not support marshalling in scenarios where pinning is impossible.
///
internal static string GetPinnableReferenceShouldSupportAllocatingMarshallingFallbackMessage {
get {
@@ -196,7 +196,7 @@ internal static string NativeTypeMustBeBlittableDescription {
}
///
- /// Looks up a localized string similar to The native type '{0}' for the type '{1}' is not blittable..
+ /// Looks up a localized string similar to The native type '{0}' for the type '{1}' is not blittable.
///
internal static string NativeTypeMustBeBlittableMessage {
get {
@@ -214,7 +214,7 @@ internal static string NativeTypeMustBeNonNullDescription {
}
///
- /// Looks up a localized string similar to The native type for the type '{0}' is null..
+ /// Looks up a localized string similar to The native type for the type '{0}' is null.
///
internal static string NativeTypeMustBeNonNullMessage {
get {
@@ -232,7 +232,7 @@ internal static string NativeTypeMustBePointerSizedDescription {
}
///
- /// Looks up a localized string similar to The native type '{0}' must be pointer sized because the managed type '{1}' has a 'GetPinnableReference' method..
+ /// Looks up a localized string similar to The native type '{0}' must be pointer sized because the managed type '{1}' has a 'GetPinnableReference' method.
///
internal static string NativeTypeMustBePointerSizedMessage {
get {
@@ -250,7 +250,7 @@ internal static string NativeTypeMustHaveRequiredShapeDescription {
}
///
- /// Looks up a localized string similar to The native type '{0}' must be a value type and have a constructor that takes one parameter of type '{1}' or a parameterless instance method named 'ToManaged' that returns '{1}'..
+ /// Looks up a localized string similar to The native type '{0}' must be a value type and have a constructor that takes one parameter of type '{1}' or a parameterless instance method named 'ToManaged' that returns '{1}'.
///
internal static string NativeTypeMustHaveRequiredShapeMessage {
get {
@@ -268,7 +268,7 @@ internal static string StackallocConstructorMustHaveStackBufferSizeConstantDescr
}
///
- /// Looks up a localized string similar to The native type '{0}' must have a 'public const int StackBufferSize' field that specifies the size of the stack buffer because it has a constructor that takes a stack-allocated Span<byte>..
+ /// Looks up a localized string similar to The native type '{0}' must have a 'public const int StackBufferSize' field that specifies the size of the stack buffer because it has a constructor that takes a stack-allocated Span<byte>.
///
internal static string StackallocConstructorMustHaveStackBufferSizeConstantMessage {
get {
@@ -286,7 +286,7 @@ internal static string StackallocMarshallingShouldSupportAllocatingMarshallingFa
}
///
- /// Looks up a localized string similar to Native type '{0}' has a stack-allocating constructor does not support marshalling in scenarios where stack allocation is impossible..
+ /// Looks up a localized string similar to Native type '{0}' has a stack-allocating constructor does not support marshalling in scenarios where stack allocation is impossible.
///
internal static string StackallocMarshallingShouldSupportAllocatingMarshallingFallbackMessage {
get {
@@ -340,7 +340,7 @@ internal static string ValuePropertyMustHaveGetterDescription {
}
///
- /// Looks up a localized string similar to The 'Value' property on the native type '{0}' must have a getter..
+ /// Looks up a localized string similar to The 'Value' property on the native type '{0}' must have a getter.
///
internal static string ValuePropertyMustHaveGetterMessage {
get {
@@ -358,7 +358,7 @@ internal static string ValuePropertyMustHaveSetterDescription {
}
///
- /// Looks up a localized string similar to The 'Value' property on the native type '{0}' must have a setter..
+ /// Looks up a localized string similar to The 'Value' property on the native type '{0}' must have a setter.
///
internal static string ValuePropertyMustHaveSetterMessage {
get {
diff --git a/DllImportGenerator/DllImportGenerator/Resources.resx b/DllImportGenerator/DllImportGenerator/Resources.resx
index 0da0c43a33d..9568b0305d5 100644
--- a/DllImportGenerator/DllImportGenerator/Resources.resx
+++ b/DllImportGenerator/DllImportGenerator/Resources.resx
@@ -121,7 +121,7 @@
A type marked with 'BlittableTypeAttribute' must be blittable.
- Type '{0}' is marked with 'BlittableTypeAttribute' but is not blittable.
+ Type '{0}' is marked with 'BlittableTypeAttribute' but is not blittable
The 'BlittableTypeAttribute' and 'NativeMarshallingAttribute' attributes are mutually exclusive.
@@ -151,49 +151,49 @@
The return type of 'GetPinnableReference' (after accounting for 'ref') must be blittable.
- The dereferenced type of the return type of the 'GetPinnableReference' method must be blittable.
+ The dereferenced type of the return type of the 'GetPinnableReference' method must be blittable
A type that supports marshalling from managed to native by pinning should also support marshalling from managed to native where pinning is impossible.
- Type '{0}' has a 'GetPinnableReference' method but its native type does not support marshalling in scenarios where pinning is impossible.
+ Type '{0}' has a 'GetPinnableReference' method but its native type does not support marshalling in scenarios where pinning is impossible
A native type for a given type must be blittable.
- The native type '{0}' for the type '{1}' is not blittable.
+ The native type '{0}' for the type '{1}' is not blittable
A native type for a given type must be non-null.
- The native type for the type '{0}' is null.
+ The native type for the type '{0}' is null
The native type must be pointer sized so the pinned result of 'GetPinnableReference' can be cast to the native type.
- The native type '{0}' must be pointer sized because the managed type '{1}' has a 'GetPinnableReference' method.
+ The native type '{0}' must be pointer sized because the managed type '{1}' has a 'GetPinnableReference' method
The native type must have at least one of the two marshalling methods to enable marshalling the managed type.
- The native type '{0}' must be a value type and have a constructor that takes one parameter of type '{1}' or a parameterless instance method named 'ToManaged' that returns '{1}'.
+ The native type '{0}' must be a value type and have a constructor that takes one parameter of type '{1}' or a parameterless instance method named 'ToManaged' that returns '{1}'
When constructor taking a Span<byte> is specified on the native type, the type must also have a public integer constant named StackBufferSize to provide the size of the stack-allocated buffer.
- The native type '{0}' must have a 'public const int StackBufferSize' field that specifies the size of the stack buffer because it has a constructor that takes a stack-allocated Span<byte>.
+ The native type '{0}' must have a 'public const int StackBufferSize' field that specifies the size of the stack buffer because it has a constructor that takes a stack-allocated Span<byte>
A type that supports marshalling from managed to native by stack allocation should also support marshalling from managed to native where stack allocation is impossible.
- Native type '{0}' has a stack-allocating constructor does not support marshalling in scenarios where stack allocation is impossible.
+ Native type '{0}' has a stack-allocating constructor does not support marshalling in scenarios where stack allocation is impossible
For types that are not supported by source-generated P/Invokes, the resulting P/Invoke will rely on the underlying runtime to marshal the specified type.
@@ -211,12 +211,12 @@
The native type's 'Value' property must have a getter to support marshalling from managed to native.
- The 'Value' property on the native type '{0}' must have a getter.
+ The 'Value' property on the native type '{0}' must have a getter
The native type's 'Value' property must have a setter to support marshalling from native to managed.
- The 'Value' property on the native type '{0}' must have a setter.
+ The 'Value' property on the native type '{0}' must have a setter
\ No newline at end of file
diff --git a/DllImportGenerator/readme.md b/DllImportGenerator/readme.md
index 30e05076eb5..e4b19e8da00 100644
--- a/DllImportGenerator/readme.md
+++ b/DllImportGenerator/readme.md
@@ -4,7 +4,7 @@ Work on this project can be tracked and discussed via the [official issue](https
## Example
-The [Demo project](./DllImportGenerator/Demo) is designed to be immediately consumable by everyone. It demonstrates a simple use case where the marshalling code is generated and a native function call with only [blittable types](https://docs.microsoft.com/dotnet/framework/interop/blittable-and-non-blittable-types) is made. A managed assembly with [native exports](./DllImportGenerator/TestAssets/NativeExports) is used in the P/Invoke scenario.
+The [Demo project](./DllImportGenerator/Demo) is designed to be immediately consumable by everyone. It demonstrates a simple use case where the marshalling code is generated and a native function call with only [blittable types](https://docs.microsoft.com/dotnet/framework/interop/blittable-and-non-blittable-types) is made. The project is configured to output the generated source to disk; the files can be found in the project's intermediate directory (`obj///generated`). A managed assembly with [native exports](./DllImportGenerator/TestAssets/NativeExports) is used in the P/Invoke scenario.
### Recommended scenarios: