Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class Ids
public const string TypeNotSupported = Prefix + "1051";
public const string ConfigurationNotSupported = Prefix + "1052";
public const string MethodNotDeclaredInAttributedInterface = Prefix + "1091";
public const string InvalidGeneratedComInterfaceAttributeUsage = Prefix + "1092";
}

private const string Category = "ComInterfaceGenerator";
Expand Down Expand Up @@ -175,11 +176,21 @@ public class Ids
isEnabledByDefault: true,
description: GetResourceString(nameof(SR.MethodNotDeclaredInAttributedInterfaceDescription)));

public static readonly DiagnosticDescriptor InvalidAttributedInterfaceMissingGuidAttribute =
new DiagnosticDescriptor(
Ids.InvalidGeneratedComInterfaceAttributeUsage,
GetResourceString(nameof(SR.InvalidGeneratedComInterfaceAttributeUsageTitle)),
GetResourceString(nameof(SR.InvalidGeneratedComInterfaceAttributeUsageMissingGuidAttribute)),
Category,
DiagnosticSeverity.Error,
isEnabledByDefault: true,
description: GetResourceString(nameof(SR.InvalidGeneratedComInterfaceAttributeUsageDescription)));

private readonly List<Diagnostic> _diagnostics = new List<Diagnostic>();

public IEnumerable<Diagnostic> Diagnostics => _diagnostics;


/// <summary>
/// Report diagnostic for invalid configuration for string marshalling.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System;
using System.Collections.Immutable;

namespace Microsoft.Interop
{
internal abstract record GeneratedMethodContextBase(ManagedTypeInfo OriginalDefiningType, SequenceEqualImmutableArray<Diagnostic> Diagnostics);

internal sealed record IncrementalMethodStubGenerationContext(
SignatureContext SignatureContext,
ContainingSyntaxContext ContainingSyntaxContext,
Expand All @@ -19,5 +22,5 @@ internal sealed record IncrementalMethodStubGenerationContext(
MarshallingGeneratorFactoryKey<(TargetFramework TargetFramework, Version TargetFrameworkVersion)> UnmanagedToManagedGeneratorFactory,
ManagedTypeInfo TypeKeyOwner,
SequenceEqualImmutableArray<Diagnostic> Diagnostics,
TypeSyntax UnwrapperSyntax);
TypeSyntax UnwrapperSyntax) : GeneratedMethodContextBase(TypeKeyOwner, Diagnostics);
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,11 @@ internal static class IncrementalValuesProviderExtensions
return builder.MoveToImmutable();
});
}

public static IncrementalValuesProvider<TNode> SelectNormalized<TNode>(this IncrementalValuesProvider<TNode> provider)
where TNode : SyntaxNode
{
return provider.Select((node, ct) => node.NormalizeWhitespace());
}
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@
<target state="translated">Zadaná hodnota není známý příznak výčtu ExceptionMarsnuming.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
<source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageMissingGuidAttribute">
<source>Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageTitle">
<source>Invalid 'GeneratedComInterfaceAttribute' usage.</source>
<target state="new">Invalid 'GeneratedComInterfaceAttribute' usage.</target>
<note />
</trans-unit>
<trans-unit id="InvalidStringMarshallingConfigurationDescription">
<source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
<target state="translated">Konfigurace StringMarshalling a StringMarshallingCustomType je neplatná.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@
<target state="translated">Der angegebene Wert ist kein bekanntes Flag der „ExceptionMarshalling“-Enumeration.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
<source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageMissingGuidAttribute">
<source>Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageTitle">
<source>Invalid 'GeneratedComInterfaceAttribute' usage.</source>
<target state="new">Invalid 'GeneratedComInterfaceAttribute' usage.</target>
<note />
</trans-unit>
<trans-unit id="InvalidStringMarshallingConfigurationDescription">
<source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
<target state="translated">Die Konfiguration von \"StringMarshalling\" und \"StringMarshallingCustomType\" ist ungültig.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@
<target state="translated">El valor proporcionado no es una marca conocida de la enumeración “ExceptionMarshalling”.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
<source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageMissingGuidAttribute">
<source>Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageTitle">
<source>Invalid 'GeneratedComInterfaceAttribute' usage.</source>
<target state="new">Invalid 'GeneratedComInterfaceAttribute' usage.</target>
<note />
</trans-unit>
<trans-unit id="InvalidStringMarshallingConfigurationDescription">
<source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
<target state="translated">La configuración de “StringMarshalling” y “StringMarshallingCustomType” no es válida.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@
<target state="translated">La valeur fournie n’est pas un indicateur connu de l’énumération « ExceptionMarshalling ».</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
<source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageMissingGuidAttribute">
<source>Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageTitle">
<source>Invalid 'GeneratedComInterfaceAttribute' usage.</source>
<target state="new">Invalid 'GeneratedComInterfaceAttribute' usage.</target>
<note />
</trans-unit>
<trans-unit id="InvalidStringMarshallingConfigurationDescription">
<source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
<target state="translated">La configuration de « StringMarshalling » et de « StringMarshallingCustomType » n’est pas valide.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@
<target state="translated">Il valore specificato non è un flag noto dell'enumerazione 'ExceptionMarshalling'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
<source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageMissingGuidAttribute">
<source>Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageTitle">
<source>Invalid 'GeneratedComInterfaceAttribute' usage.</source>
<target state="new">Invalid 'GeneratedComInterfaceAttribute' usage.</target>
<note />
</trans-unit>
<trans-unit id="InvalidStringMarshallingConfigurationDescription">
<source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
<target state="translated">La configurazione di 'StringMarshalling' e 'StringMarshallingCustomType' non è valida.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@
<target state="translated">指定された値は、'ExceptionMarshalling' 列挙型の既知のフラグではありません。</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
<source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageMissingGuidAttribute">
<source>Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageTitle">
<source>Invalid 'GeneratedComInterfaceAttribute' usage.</source>
<target state="new">Invalid 'GeneratedComInterfaceAttribute' usage.</target>
<note />
</trans-unit>
<trans-unit id="InvalidStringMarshallingConfigurationDescription">
<source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
<target state="translated">'StringMarshalling' と 'StringMarshallingCustomType' の構成が無効です。</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@
<target state="translated">제공된 값은 'ExceptionMarshalling' 열거형의 알려진 플래그가 아닙니다.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
<source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageMissingGuidAttribute">
<source>Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageTitle">
<source>Invalid 'GeneratedComInterfaceAttribute' usage.</source>
<target state="new">Invalid 'GeneratedComInterfaceAttribute' usage.</target>
<note />
</trans-unit>
<trans-unit id="InvalidStringMarshallingConfigurationDescription">
<source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
<target state="translated">'StringMarshalling' 및 'StringMarshallingCustomType'의 구성이 잘못되었습니다.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@
<target state="translated">Podana wartość nie jest znaną flagą wyliczenia „'ExceptionMarshalling”.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
<source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageMissingGuidAttribute">
<source>Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageTitle">
<source>Invalid 'GeneratedComInterfaceAttribute' usage.</source>
<target state="new">Invalid 'GeneratedComInterfaceAttribute' usage.</target>
<note />
</trans-unit>
<trans-unit id="InvalidStringMarshallingConfigurationDescription">
<source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
<target state="translated">Konfiguracja elementów „StringMarshalling” i „StringMarshallingCustomType” jest nieprawidłowa.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@
<target state="translated">O valor fornecido não é um sinalizador conhecido da enumeração 'ExceptionMarshalling'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
<source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageMissingGuidAttribute">
<source>Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageTitle">
<source>Invalid 'GeneratedComInterfaceAttribute' usage.</source>
<target state="new">Invalid 'GeneratedComInterfaceAttribute' usage.</target>
<note />
</trans-unit>
<trans-unit id="InvalidStringMarshallingConfigurationDescription">
<source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
<target state="translated">A configuração de 'StringMarshalling' e 'StringMarshallingCustomType' é inválida.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@
<target state="translated">Указанное значение не является известным флагом перечисления ExceptionMarshalling.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageDescription">
<source>Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interfaces attributed with 'GeneratedComInterfaceAttribute' must be partial and must specify a GUID with 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageMissingGuidAttribute">
<source>Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</source>
<target state="new">Interface '{0}' is attributed with 'GeneratedComInterfaceAttribute' but is missing 'System.Runtime.InteropServices.GuidAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="InvalidGeneratedComInterfaceAttributeUsageTitle">
<source>Invalid 'GeneratedComInterfaceAttribute' usage.</source>
<target state="new">Invalid 'GeneratedComInterfaceAttribute' usage.</target>
<note />
</trans-unit>
<trans-unit id="InvalidStringMarshallingConfigurationDescription">
<source>The configuration of 'StringMarshalling' and 'StringMarshallingCustomType' is invalid.</source>
<target state="translated">Конфигурация \"StringMarshalling\" и \"StringMarshallingCustomType\" недопустима.</target>
Expand Down
Loading