mirror of
https://github.com/VSadov/Satori.git
synced 2025-06-10 18:11:04 +09:00
Enable running analyzers on DllImportGenerator and Microsoft.Interop.SourceGeneration (#59683)
This commit is contained in:
parent
7c87cc1aa5
commit
3f78928969
36 changed files with 100 additions and 93 deletions
|
@ -18,7 +18,7 @@
|
|||
unconditionally in Microsoft.NETCoreSdk.BundledVersions.props.
|
||||
-->
|
||||
<NETCoreAppMaximumVersion>$(MajorVersion).$(MinorVersion)</NETCoreAppMaximumVersion>
|
||||
<EnableNETAnalyzers Condition="'$(EnableAnalyzers)' != 'true'">false</EnableNETAnalyzers>
|
||||
<EnableNETAnalyzers Condition="'$(EnableNETAnalyzers)' == ''">$(RunAnalyzers)</EnableNETAnalyzers>
|
||||
<!-- SDK sets product to assembly but we want it to be our product name -->
|
||||
<Product>Microsoft%AE .NET</Product>
|
||||
<!-- Use the .NET product branding version for informational version description -->
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
{
|
||||
private const string Category = "Interoperability";
|
||||
|
||||
public readonly static DiagnosticDescriptor ConvertToGeneratedDllImport =
|
||||
public static readonly DiagnosticDescriptor ConvertToGeneratedDllImport =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.ConvertToGeneratedDllImport,
|
||||
GetResourceString(nameof(Resources.ConvertToGeneratedDllImportTitle)),
|
||||
|
|
|
@ -276,7 +276,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
generator.AttributeArgument("CallConvs",
|
||||
generator.ArrayCreationExpression(
|
||||
generator.TypeExpression(editor.SemanticModel.Compilation.GetTypeByMetadataName(TypeNames.System_Type)),
|
||||
new [] { generator.TypeOfExpression(generator.TypeExpression(callingConventionType)) })));
|
||||
new[] { generator.TypeOfExpression(generator.TypeExpression(callingConventionType)) })));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
{
|
||||
private const string Category = "Usage";
|
||||
|
||||
public readonly static DiagnosticDescriptor GeneratedDllImportMissingModifiers =
|
||||
public static readonly DiagnosticDescriptor GeneratedDllImportMissingModifiers =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.GeneratedDllImportMissingRequiredModifiers,
|
||||
GetResourceString(nameof(Resources.GeneratedDllImportMissingModifiersTitle)),
|
||||
|
@ -28,7 +28,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.GeneratedDllImportMissingModifiersDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor GeneratedDllImportContainingTypeMissingModifiers =
|
||||
public static readonly DiagnosticDescriptor GeneratedDllImportContainingTypeMissingModifiers =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.GeneratedDllImportContaiingTypeMissingRequiredModifiers,
|
||||
GetResourceString(nameof(Resources.GeneratedDllImportContainingTypeMissingModifiersTitle)),
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
{
|
||||
private const string Category = "Usage";
|
||||
|
||||
public readonly static DiagnosticDescriptor BlittableTypeMustBeBlittableRule =
|
||||
public static readonly DiagnosticDescriptor BlittableTypeMustBeBlittableRule =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.BlittableTypeMustBeBlittable,
|
||||
"BlittableTypeMustBeBlittable",
|
||||
|
@ -27,7 +27,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.BlittableTypeMustBeBlittableDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor CannotHaveMultipleMarshallingAttributesRule =
|
||||
public static readonly DiagnosticDescriptor CannotHaveMultipleMarshallingAttributesRule =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.CannotHaveMultipleMarshallingAttributes,
|
||||
"CannotHaveMultipleMarshallingAttributes",
|
||||
|
@ -37,7 +37,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.CannotHaveMultipleMarshallingAttributesDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor NativeTypeMustBeNonNullRule =
|
||||
public static readonly DiagnosticDescriptor NativeTypeMustBeNonNullRule =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.NativeTypeMustBeNonNull,
|
||||
"NativeTypeMustBeNonNull",
|
||||
|
@ -47,7 +47,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.NativeTypeMustBeNonNullDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor NativeTypeMustBeBlittableRule =
|
||||
public static readonly DiagnosticDescriptor NativeTypeMustBeBlittableRule =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.NativeTypeMustBeBlittable,
|
||||
"NativeTypeMustBeBlittable",
|
||||
|
@ -57,7 +57,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.BlittableTypeMustBeBlittableDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor GetPinnableReferenceReturnTypeBlittableRule =
|
||||
public static readonly DiagnosticDescriptor GetPinnableReferenceReturnTypeBlittableRule =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.GetPinnableReferenceReturnTypeBlittable,
|
||||
"GetPinnableReferenceReturnTypeBlittable",
|
||||
|
@ -67,7 +67,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.GetPinnableReferenceReturnTypeBlittableDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor NativeTypeMustBePointerSizedRule =
|
||||
public static readonly DiagnosticDescriptor NativeTypeMustBePointerSizedRule =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.NativeTypeMustBePointerSized,
|
||||
"NativeTypeMustBePointerSized",
|
||||
|
@ -77,7 +77,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.NativeTypeMustBePointerSizedDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor NativeTypeMustHaveRequiredShapeRule =
|
||||
public static readonly DiagnosticDescriptor NativeTypeMustHaveRequiredShapeRule =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.NativeTypeMustHaveRequiredShape,
|
||||
"NativeTypeMustHaveRequiredShape",
|
||||
|
@ -87,7 +87,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.NativeTypeMustHaveRequiredShapeDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor CollectionNativeTypeMustHaveRequiredShapeRule =
|
||||
public static readonly DiagnosticDescriptor CollectionNativeTypeMustHaveRequiredShapeRule =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.NativeTypeMustHaveRequiredShape,
|
||||
"NativeTypeMustHaveRequiredShape",
|
||||
|
@ -97,7 +97,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.CollectionNativeTypeMustHaveRequiredShapeDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor ValuePropertyMustHaveSetterRule =
|
||||
public static readonly DiagnosticDescriptor ValuePropertyMustHaveSetterRule =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.ValuePropertyMustHaveSetter,
|
||||
"ValuePropertyMustHaveSetter",
|
||||
|
@ -107,7 +107,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.ValuePropertyMustHaveSetterDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor ValuePropertyMustHaveGetterRule =
|
||||
public static readonly DiagnosticDescriptor ValuePropertyMustHaveGetterRule =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.ValuePropertyMustHaveGetter,
|
||||
"ValuePropertyMustHaveGetter",
|
||||
|
@ -117,7 +117,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.ValuePropertyMustHaveGetterDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor GetPinnableReferenceShouldSupportAllocatingMarshallingFallbackRule =
|
||||
public static readonly DiagnosticDescriptor GetPinnableReferenceShouldSupportAllocatingMarshallingFallbackRule =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.GetPinnableReferenceShouldSupportAllocatingMarshallingFallback,
|
||||
"GetPinnableReferenceShouldSupportAllocatingMarshallingFallback",
|
||||
|
@ -127,7 +127,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.GetPinnableReferenceShouldSupportAllocatingMarshallingFallbackDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor StackallocMarshallingShouldSupportAllocatingMarshallingFallbackRule =
|
||||
public static readonly DiagnosticDescriptor StackallocMarshallingShouldSupportAllocatingMarshallingFallbackRule =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.StackallocMarshallingShouldSupportAllocatingMarshallingFallback,
|
||||
"StackallocMarshallingShouldSupportAllocatingMarshallingFallback",
|
||||
|
@ -137,7 +137,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.StackallocMarshallingShouldSupportAllocatingMarshallingFallbackDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor StackallocConstructorMustHaveStackBufferSizeConstantRule =
|
||||
public static readonly DiagnosticDescriptor StackallocConstructorMustHaveStackBufferSizeConstantRule =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.StackallocConstructorMustHaveStackBufferSizeConstant,
|
||||
"StackallocConstructorMustHaveStackBufferSizeConstant",
|
||||
|
@ -147,7 +147,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.StackallocConstructorMustHaveStackBufferSizeConstantDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor RefValuePropertyUnsupportedRule =
|
||||
public static readonly DiagnosticDescriptor RefValuePropertyUnsupportedRule =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.RefValuePropertyUnsupported,
|
||||
"RefValuePropertyUnsupported",
|
||||
|
@ -157,7 +157,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.RefValuePropertyUnsupportedDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor NativeGenericTypeMustBeClosedOrMatchArityRule =
|
||||
public static readonly DiagnosticDescriptor NativeGenericTypeMustBeClosedOrMatchArityRule =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.NativeGenericTypeMustBeClosedOrMatchArity,
|
||||
"NativeGenericTypeMustBeClosedOrMatchArity",
|
||||
|
@ -223,7 +223,7 @@ namespace Microsoft.Interop.Analyzers
|
|||
}
|
||||
}
|
||||
|
||||
class PerCompilationAnalyzer
|
||||
private class PerCompilationAnalyzer
|
||||
{
|
||||
private readonly INamedTypeSymbol GeneratedMarshallingAttribute;
|
||||
private readonly INamedTypeSymbol BlittableTypeAttribute;
|
||||
|
|
|
@ -15,6 +15,8 @@ using System.Text;
|
|||
using System.Threading;
|
||||
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
|
||||
|
||||
[assembly: System.Resources.NeutralResourcesLanguage("en-US")]
|
||||
|
||||
namespace Microsoft.Interop
|
||||
{
|
||||
[Generator]
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>Microsoft.Interop</RootNamespace>
|
||||
<IsRoslynComponent>true</IsRoslynComponent>
|
||||
<RunAnalyzers>true</RunAnalyzers>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
|
|
@ -5,7 +5,7 @@ using Microsoft.CodeAnalysis.Diagnostics;
|
|||
|
||||
namespace Microsoft.Interop
|
||||
{
|
||||
record DllImportGeneratorOptions(bool GenerateForwarders, bool UseMarshalType, bool UseInternalUnsafeType)
|
||||
internal record DllImportGeneratorOptions(bool GenerateForwarders, bool UseMarshalType, bool UseInternalUnsafeType)
|
||||
{
|
||||
public DllImportGeneratorOptions(AnalyzerConfigOptions options)
|
||||
: this(options.GenerateForwarders(), options.UseMarshalType(), options.UseInternalUnsafeType())
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace Microsoft.Interop
|
|||
// Use the declaring syntax as a basis for this type declaration.
|
||||
// Since we're generating source for the method, we know that the current type
|
||||
// has to be declared in source.
|
||||
TypeDeclarationSyntax typeDecl = (TypeDeclarationSyntax)currType.DeclaringSyntaxReferences[0].GetSyntax();
|
||||
TypeDeclarationSyntax typeDecl = (TypeDeclarationSyntax)currType.DeclaringSyntaxReferences[0].GetSyntax(token);
|
||||
// Remove current members, attributes, and base list so we don't double declare them.
|
||||
typeDecl = typeDecl.WithMembers(List<MemberDeclarationSyntax>())
|
||||
.WithAttributeLists(List<AttributeListSyntax>())
|
||||
|
|
|
@ -7,7 +7,7 @@ using System.Text;
|
|||
|
||||
namespace Microsoft.Interop
|
||||
{
|
||||
class ForwarderMarshallingGeneratorFactory : IMarshallingGeneratorFactory
|
||||
internal class ForwarderMarshallingGeneratorFactory : IMarshallingGeneratorFactory
|
||||
{
|
||||
private static readonly Forwarder Forwarder = new Forwarder();
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Microsoft.Interop
|
|||
|
||||
private const string Category = "SourceGeneration";
|
||||
|
||||
public readonly static DiagnosticDescriptor ParameterTypeNotSupported =
|
||||
public static readonly DiagnosticDescriptor ParameterTypeNotSupported =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.TypeNotSupported,
|
||||
GetResourceString(nameof(Resources.TypeNotSupportedTitle)),
|
||||
|
@ -37,7 +37,7 @@ namespace Microsoft.Interop
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.TypeNotSupportedDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor ReturnTypeNotSupported =
|
||||
public static readonly DiagnosticDescriptor ReturnTypeNotSupported =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.TypeNotSupported,
|
||||
GetResourceString(nameof(Resources.TypeNotSupportedTitle)),
|
||||
|
@ -47,7 +47,7 @@ namespace Microsoft.Interop
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.TypeNotSupportedDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor ParameterTypeNotSupportedWithDetails =
|
||||
public static readonly DiagnosticDescriptor ParameterTypeNotSupportedWithDetails =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.TypeNotSupported,
|
||||
GetResourceString(nameof(Resources.TypeNotSupportedTitle)),
|
||||
|
@ -57,7 +57,7 @@ namespace Microsoft.Interop
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.TypeNotSupportedDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor ReturnTypeNotSupportedWithDetails =
|
||||
public static readonly DiagnosticDescriptor ReturnTypeNotSupportedWithDetails =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.TypeNotSupported,
|
||||
GetResourceString(nameof(Resources.TypeNotSupportedTitle)),
|
||||
|
@ -67,7 +67,7 @@ namespace Microsoft.Interop
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.TypeNotSupportedDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor ParameterConfigurationNotSupported =
|
||||
public static readonly DiagnosticDescriptor ParameterConfigurationNotSupported =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.ConfigurationNotSupported,
|
||||
GetResourceString(nameof(Resources.ConfigurationNotSupportedTitle)),
|
||||
|
@ -77,7 +77,7 @@ namespace Microsoft.Interop
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.ConfigurationNotSupportedDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor ReturnConfigurationNotSupported =
|
||||
public static readonly DiagnosticDescriptor ReturnConfigurationNotSupported =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.ConfigurationNotSupported,
|
||||
GetResourceString(nameof(Resources.ConfigurationNotSupportedTitle)),
|
||||
|
@ -87,7 +87,7 @@ namespace Microsoft.Interop
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.ConfigurationNotSupportedDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor ConfigurationNotSupported =
|
||||
public static readonly DiagnosticDescriptor ConfigurationNotSupported =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.ConfigurationNotSupported,
|
||||
GetResourceString(nameof(Resources.ConfigurationNotSupportedTitle)),
|
||||
|
@ -97,7 +97,7 @@ namespace Microsoft.Interop
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.ConfigurationNotSupportedDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor ConfigurationValueNotSupported =
|
||||
public static readonly DiagnosticDescriptor ConfigurationValueNotSupported =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.ConfigurationNotSupported,
|
||||
GetResourceString(nameof(Resources.ConfigurationNotSupportedTitle)),
|
||||
|
@ -107,7 +107,7 @@ namespace Microsoft.Interop
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.ConfigurationNotSupportedDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor MarshallingAttributeConfigurationNotSupported =
|
||||
public static readonly DiagnosticDescriptor MarshallingAttributeConfigurationNotSupported =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.ConfigurationNotSupported,
|
||||
GetResourceString(nameof(Resources.ConfigurationNotSupportedTitle)),
|
||||
|
@ -117,7 +117,7 @@ namespace Microsoft.Interop
|
|||
isEnabledByDefault: true,
|
||||
description: GetResourceString(nameof(Resources.ConfigurationNotSupportedDescription)));
|
||||
|
||||
public readonly static DiagnosticDescriptor TargetFrameworkNotSupported =
|
||||
public static readonly DiagnosticDescriptor TargetFrameworkNotSupported =
|
||||
new DiagnosticDescriptor(
|
||||
Ids.TargetFrameworkNotSupported,
|
||||
GetResourceString(nameof(Resources.TargetFrameworkNotSupportedTitle)),
|
||||
|
|
|
@ -9,7 +9,7 @@ using System.Text;
|
|||
|
||||
namespace Microsoft.Interop
|
||||
{
|
||||
class NoPreserveSigMarshallingGeneratorFactory : IMarshallingGeneratorFactory
|
||||
internal class NoPreserveSigMarshallingGeneratorFactory : IMarshallingGeneratorFactory
|
||||
{
|
||||
private static readonly HResultExceptionMarshaller HResultException = new HResultExceptionMarshaller();
|
||||
private readonly IMarshallingGeneratorFactory inner;
|
||||
|
|
|
@ -35,7 +35,6 @@ namespace Microsoft.Interop
|
|||
else if (context.SingleFrameSpansNativeContext && !info.IsManagedReturnPosition)
|
||||
{
|
||||
return Argument(IdentifierName(context.GetIdentifiers(info).native));
|
||||
|
||||
}
|
||||
return Argument(
|
||||
PrefixUnaryExpression(
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Microsoft.Interop
|
|||
/// <summary>
|
||||
/// The base interface for implementing various different aspects of the custom native type and collection marshalling specs.
|
||||
/// </summary>
|
||||
interface ICustomNativeTypeMarshallingStrategy
|
||||
internal interface ICustomNativeTypeMarshallingStrategy
|
||||
{
|
||||
TypeSyntax AsNativeType(TypePositionInfo info);
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace Microsoft.Interop
|
|||
|
||||
// Now that we have initialized our map of edges and we have our list of nodes,
|
||||
// we'll use Khan's algorithm to calculate a topological sort of the elements.
|
||||
// Algorithm adapted from A. B. Kahn. 1962. Topological sorting of large networks. Commun. ACM 5, 11 (Nov. 1962), 558–562. DOI:https://doi.org/10.1145/368996.369025
|
||||
// Algorithm adapted from A. B. Kahn. 1962. Topological sorting of large networks. Commun. ACM 5, 11 (Nov. 1962), 558-562. DOI:https://doi.org/10.1145/368996.369025
|
||||
|
||||
// L is the sorted list
|
||||
List<T> L = new(elements.Count);
|
||||
|
|
|
@ -117,7 +117,7 @@ namespace Microsoft.Interop
|
|||
NotSupportedDetails = Resources.SafeHandleByRefMustBeConcrete
|
||||
};
|
||||
}
|
||||
return new SafeHandleMarshaller();
|
||||
return SafeHandle;
|
||||
|
||||
case { ManagedType: SpecialTypeInfo { SpecialType: SpecialType.System_Char } }:
|
||||
return CreateCharMarshaller(info, context);
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace Microsoft.Interop
|
|||
.WithArgumentList(
|
||||
ArgumentList(
|
||||
SeparatedList(
|
||||
new []{
|
||||
new[]{
|
||||
Argument(
|
||||
TypeOfExpression(
|
||||
info.ManagedType.Syntax)),
|
||||
|
@ -179,7 +179,7 @@ namespace Microsoft.Interop
|
|||
ParseTypeName(TypeNames.System_Runtime_InteropServices_Marshal),
|
||||
IdentifierName("InitHandle")),
|
||||
ArgumentList(SeparatedList(
|
||||
new []
|
||||
new[]
|
||||
{
|
||||
Argument(IdentifierName(newHandleObjectIdentifier)),
|
||||
Argument(IdentifierName(nativeIdentifier))
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace Microsoft.Interop
|
|||
}
|
||||
break;
|
||||
case StubCodeContext.Stage.Cleanup:
|
||||
yield return GenerateConditionalAllocationFreeSyntax(info ,context);
|
||||
yield return GenerateConditionalAllocationFreeSyntax(info, context);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -189,14 +189,14 @@ namespace Microsoft.Interop
|
|||
IdentifierName(context.GetIdentifiers(info).managed))),
|
||||
IdentifierName("CopyTo")),
|
||||
ArgumentList(
|
||||
SeparatedList(new [] {
|
||||
SeparatedList(new[] {
|
||||
Argument(
|
||||
ObjectCreationExpression(
|
||||
GenericName(Identifier(TypeNames.System_Span),
|
||||
TypeArgumentList(SingletonSeparatedList<TypeSyntax>(
|
||||
PredefinedType(Token(SyntaxKind.CharKeyword))))),
|
||||
ArgumentList(
|
||||
SeparatedList(new []{
|
||||
SeparatedList(new[]{
|
||||
Argument(IdentifierName(stackAllocPtrIdentifier)),
|
||||
Argument(IdentifierName(byteLengthIdentifier))})),
|
||||
initializer: null))}))));
|
||||
|
|
|
@ -322,7 +322,7 @@ namespace Microsoft.Interop
|
|||
return NoMarshallingInfo.Instance;
|
||||
}
|
||||
|
||||
CountInfo CreateCountInfo(AttributeData marshalUsingData, ImmutableHashSet<string> inspectedElements)
|
||||
private CountInfo CreateCountInfo(AttributeData marshalUsingData, ImmutableHashSet<string> inspectedElements)
|
||||
{
|
||||
int? constSize = null;
|
||||
string? elementName = null;
|
||||
|
@ -442,7 +442,7 @@ namespace Microsoft.Interop
|
|||
return null;
|
||||
}
|
||||
|
||||
MarshallingInfo CreateInfoFromMarshalAs(
|
||||
private MarshallingInfo CreateInfoFromMarshalAs(
|
||||
ITypeSymbol type,
|
||||
AttributeData attrData,
|
||||
ImmutableHashSet<string> inspectedElements,
|
||||
|
@ -559,7 +559,7 @@ namespace Microsoft.Interop
|
|||
ElementMarshallingInfo: elementMarshallingInfo);
|
||||
}
|
||||
|
||||
MarshallingInfo CreateNativeMarshallingInfo(
|
||||
private MarshallingInfo CreateNativeMarshallingInfo(
|
||||
ITypeSymbol type,
|
||||
AttributeData attrData,
|
||||
bool isMarshalUsingAttribute,
|
||||
|
@ -695,7 +695,7 @@ namespace Microsoft.Interop
|
|||
UseDefaultMarshalling: !isMarshalUsingAttribute);
|
||||
}
|
||||
|
||||
bool TryCreateTypeBasedMarshallingInfo(
|
||||
private bool TryCreateTypeBasedMarshallingInfo(
|
||||
ITypeSymbol type,
|
||||
CountInfo parsedCountInfo,
|
||||
int indirectionLevel,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<Packable>false</Packable>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>Microsoft.Interop</RootNamespace>
|
||||
<RunAnalyzers>true</RunAnalyzers>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
[assembly: System.Resources.NeutralResourcesLanguage("en-US")]
|
Loading…
Add table
Add a link
Reference in a new issue