// If we're in a "supported" scenario, then emit a diagnostic as our final fallback.
generatorFactory = new UnsupportedMarshallingFactory();
- generatorFactory = new NoMarshallingInfoErrorMarshallingFactory(generatorFactory);
+ generatorFactory = new NoMarshallingInfoErrorMarshallingFactory(generatorFactory, TypeNames.GeneratedComInterfaceAttribute_ShortName);
// The presence of System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute is tied to TFM,
// so we use TFM in the generator factory key instead of the Compilation as the compilation changes on every keystroke.
// Since the char type can go into the P/Invoke signature here, we can only use it when
// runtime marshalling is disabled.
- generatorFactory = new CharMarshallingGeneratorFactory(generatorFactory, useBlittableMarshallerForUtf16: runtimeMarshallingDisabled);
+ generatorFactory = new CharMarshallingGeneratorFactory(generatorFactory, useBlittableMarshallerForUtf16: runtimeMarshallingDisabled, TypeNames.GeneratedComInterfaceAttribute_ShortName);
InteropGenerationOptions interopGenerationOptions = new(UseMarshalType: true);
generatorFactory = new MarshalAsMarshallingGeneratorFactory(interopGenerationOptions, generatorFactory);
IMarshallingGeneratorFactory elementFactory = new AttributedMarshallingModelGeneratorFactory(
// Since the char type in an array will not be part of the P/Invoke signature, we can
// use the regular blittable marshaller in all cases.
- new CharMarshallingGeneratorFactory(generatorFactory, useBlittableMarshallerForUtf16: true),
+ new CharMarshallingGeneratorFactory(generatorFactory, useBlittableMarshallerForUtf16: true, TypeNames.GeneratedComInterfaceAttribute_ShortName),
new AttributedMarshallingModelOptions(runtimeMarshallingDisabled, MarshalMode.ElementIn, MarshalMode.ElementRef, MarshalMode.ElementOut));
// We don't need to include the later generator factories for collection elements
// as the later generator factories only apply to parameters.
var forwarder = new Forwarder();
return MethodDeclaration(GenerationContext.SignatureContext.StubReturnType, MethodInfo.MethodName)
.WithModifiers(TokenList(Token(SyntaxKind.NewKeyword)))
+ .WithAttributeLists(List(GenerationContext.SignatureContext.AdditionalAttributes.Concat(MethodInfo.Attributes.Select(a => a.GenerateAttributeList()))))
.WithParameterList(ParameterList(SeparatedList(GenerationContext.SignatureContext.StubParameters)))
.WithExpressionBody(
ArrowExpressionClause(
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
+using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
/// </summary>
internal sealed record ComMethodInfo(
MethodDeclarationSyntax Syntax,
- string MethodName)
+ string MethodName,
+ SequenceEqualImmutableArray<AttributeInfo> Attributes)
{
/// <summary>
/// Returns a list of tuples of ComMethodInfo, IMethodSymbol, and Diagnostic. If ComMethodInfo is null, Diagnostic will not be null, and vice versa.
{
return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From(diag);
}
- var comMethodInfo = new ComMethodInfo(comMethodDeclaringSyntax, method.Name);
+
+ var attributes = method.GetAttributes();
+ var attributeInfos = ImmutableArray.CreateBuilder<AttributeInfo>(attributes.Length);
+ foreach (var attr in attributes)
+ {
+ attributeInfos.Add(AttributeInfo.From(attr));
+ }
+ var comMethodInfo = new ComMethodInfo(comMethodDeclaringSyntax, method.Name, attributeInfos.MoveToImmutable().ToSequenceEqual());
return DiagnosticOr<(ComMethodInfo, IMethodSymbol)>.From((comMethodInfo, method));
}
}
// If we're in a "supported" scenario, then emit a diagnostic as our final fallback.
generatorFactory = new UnsupportedMarshallingFactory();
- generatorFactory = new NoMarshallingInfoErrorMarshallingFactory(generatorFactory);
+ generatorFactory = new NoMarshallingInfoErrorMarshallingFactory(generatorFactory, TypeNames.VirtualMethodIndexAttribute_ShortName);
// The presence of System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute is tied to TFM,
// so we use TFM in the generator factory key instead of the Compilation as the compilation changes on every keystroke.
// Since the char type can go into the P/Invoke signature here, we can only use it when
// runtime marshalling is disabled.
- generatorFactory = new CharMarshallingGeneratorFactory(generatorFactory, useBlittableMarshallerForUtf16: runtimeMarshallingDisabled);
+ generatorFactory = new CharMarshallingGeneratorFactory(generatorFactory, useBlittableMarshallerForUtf16: runtimeMarshallingDisabled, TypeNames.VirtualMethodIndexAttribute_ShortName);
InteropGenerationOptions interopGenerationOptions = new(UseMarshalType: true);
generatorFactory = new MarshalAsMarshallingGeneratorFactory(interopGenerationOptions, generatorFactory);
IMarshallingGeneratorFactory elementFactory = new AttributedMarshallingModelGeneratorFactory(
// Since the char type in an array will not be part of the P/Invoke signature, we can
// use the regular blittable marshaller in all cases.
- new CharMarshallingGeneratorFactory(generatorFactory, useBlittableMarshallerForUtf16: true),
+ new CharMarshallingGeneratorFactory(generatorFactory, useBlittableMarshallerForUtf16: true, TypeNames.VirtualMethodIndexAttribute_ShortName),
new AttributedMarshallingModelOptions(runtimeMarshallingDisabled, MarshalMode.ElementIn, MarshalMode.ElementRef, MarshalMode.ElementOut));
// We don't need to include the later generator factories for collection elements
// as the later generator factories only apply to parameters.
generatorFactory = new UnsupportedMarshallingFactory();
}
- generatorFactory = new NoMarshallingInfoErrorMarshallingFactory(generatorFactory);
+ generatorFactory = new NoMarshallingInfoErrorMarshallingFactory(generatorFactory, TypeNames.LibraryImportAttribute_ShortName);
// The presence of System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute is tied to TFM,
// so we use TFM in the generator factory key instead of the Compilation as the compilation changes on every keystroke.
// Since the char type can go into the P/Invoke signature here, we can only use it when
// runtime marshalling is disabled.
- generatorFactory = new CharMarshallingGeneratorFactory(generatorFactory, useBlittableMarshallerForUtf16: runtimeMarshallingDisabled);
+ generatorFactory = new CharMarshallingGeneratorFactory(generatorFactory, useBlittableMarshallerForUtf16: runtimeMarshallingDisabled, TypeNames.LibraryImportAttribute_ShortName);
InteropGenerationOptions interopGenerationOptions = new(options.UseMarshalType);
generatorFactory = new MarshalAsMarshallingGeneratorFactory(interopGenerationOptions, generatorFactory);
IMarshallingGeneratorFactory elementFactory = new AttributedMarshallingModelGeneratorFactory(
// Since the char type in an array will not be part of the P/Invoke signature, we can
// use the regular blittable marshaller in all cases.
- new CharMarshallingGeneratorFactory(generatorFactory, useBlittableMarshallerForUtf16: true),
+ new CharMarshallingGeneratorFactory(generatorFactory, useBlittableMarshallerForUtf16: true, TypeNames.LibraryImportAttribute_ShortName),
new AttributedMarshallingModelOptions(runtimeMarshallingDisabled, MarshalMode.ElementIn, MarshalMode.ElementRef, MarshalMode.ElementOut));
// We don't need to include the later generator factories for collection elements
// as the later generator factories only apply to parameters.
private readonly IMarshallingGeneratorFactory _inner;
private readonly bool _useBlittableMarshallerForUtf16;
+ private readonly string _stringMarshallingAttribute;
+ // Needed for API compatibility with preview 4
public CharMarshallingGeneratorFactory(IMarshallingGeneratorFactory inner, bool useBlittableMarshallerForUtf16)
{
_inner = inner;
_useBlittableMarshallerForUtf16 = useBlittableMarshallerForUtf16;
+ _stringMarshallingAttribute = "LibraryImportGenerator";
+ }
+
+ public CharMarshallingGeneratorFactory(IMarshallingGeneratorFactory inner, bool useBlittableMarshallerForUtf16, string stringMarshallingAttribute)
+ {
+ _inner = inner;
+ _useBlittableMarshallerForUtf16 = useBlittableMarshallerForUtf16;
+ _stringMarshallingAttribute = stringMarshallingAttribute;
}
public IMarshallingGenerator Create(TypePositionInfo info, StubCodeContext context)
// [Compat] Require explicit marshalling information.
throw new MarshallingNotSupportedException(info, context)
{
- NotSupportedDetails = SR.MarshallingStringOrCharAsUndefinedNotSupported
+ NotSupportedDetails = string.Format(SR.MarshallingStringOrCharAsUndefinedNotSupported, _stringMarshallingAttribute)
};
}
return _inner.Create(info, context);
}
+ // Necessary for API compatibility with preview 4 SDK
public NoMarshallingInfoErrorMarshallingFactory(IMarshallingGeneratorFactory inner)
- : this(inner, DefaultTypeToErrorMessageMap)
+ : this(inner, DefaultTypeToErrorMessageMap("LibraryImportAttribute"))
+ {
+ }
+
+ public NoMarshallingInfoErrorMarshallingFactory(IMarshallingGeneratorFactory inner, string stringMarshallingAttribute)
+ : this(inner, DefaultTypeToErrorMessageMap(stringMarshallingAttribute))
{
}
public ImmutableDictionary<ManagedTypeInfo, string> CustomTypeToErrorMessageMap { get; }
- private static ImmutableDictionary<ManagedTypeInfo, string> DefaultTypeToErrorMessageMap { get; } =
- ImmutableDictionary.CreateRange(new Dictionary<ManagedTypeInfo, string>
+ private static ImmutableDictionary<ManagedTypeInfo, string> DefaultTypeToErrorMessageMap(string stringMarshallingAttribute)
+ => ImmutableDictionary.CreateRange(new Dictionary<ManagedTypeInfo, string>
{
- { SpecialTypeInfo.String, SR.MarshallingStringOrCharAsUndefinedNotSupported },
+ { SpecialTypeInfo.String, string.Format(SR.MarshallingStringOrCharAsUndefinedNotSupported, stringMarshallingAttribute) },
{ SpecialTypeInfo.Boolean, SR.MarshallingBoolAsUndefinedNotSupported },
});
}
<value>Marshalling char with 'StringMarshalling.{0}' is not supported. Instead, manually convert the char type to the desired byte representation and pass to the source-generated P/Invoke.</value>
</data>
<data name="MarshallingStringOrCharAsUndefinedNotSupported" xml:space="preserve">
- <value>Marshalling string or char without explicit marshalling information is not supported. Specify 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</value>
+ <value>Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</value>
</data>
<data name="SafeHandleByRefMustBeConcrete" xml:space="preserve">
<value>An abstract type derived from 'SafeHandle' cannot be marshalled by reference. The provided type must be concrete.</value>
<note />
</trans-unit>
<trans-unit id="MarshallingStringOrCharAsUndefinedNotSupported">
- <source>Marshalling string or char without explicit marshalling information is not supported. Specify 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
- <target state="translated">Zařazování řetězce nebo znaku bez explicitních informací o zařazování se nepodporuje. Zadejte LibraryImportAttribute.StringMarshalling, LibraryImportAttribute.StringMarshallingCustomType, MarshalUsingAttribute nebo MarshalAsAttribute.</target>
+ <source>Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
+ <target state="new">Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="RuntimeMarshallingMustBeDisabled">
<note />
</trans-unit>
<trans-unit id="MarshallingStringOrCharAsUndefinedNotSupported">
- <source>Marshalling string or char without explicit marshalling information is not supported. Specify 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
- <target state="translated">Das Marshalling von Zeichenfolgen oder Zeichen ohne explizite Marshalling-Informationen wird nicht unterstützt. Geben Sie „LibraryImportAttribute.StringMarshalling“, „LibraryImportAttribute.StringMarshallingCustomType“, „MarshalUsingAttribute“ oder „MarshalAsAttribute“ an.</target>
+ <source>Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
+ <target state="new">Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="RuntimeMarshallingMustBeDisabled">
<note />
</trans-unit>
<trans-unit id="MarshallingStringOrCharAsUndefinedNotSupported">
- <source>Marshalling string or char without explicit marshalling information is not supported. Specify 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
- <target state="translated">No se admite la serialización de cadenas o caracteres sin información de serialización explícita. Especifique \"LibraryImportAttribute.StringMars slaing\", \"LibraryImportAttribute.StringMars slaingCustomType\", \"MarshalUsingAttribute\" o \"MarshalAsAttribute\".</target>
+ <source>Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
+ <target state="new">Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="RuntimeMarshallingMustBeDisabled">
<note />
</trans-unit>
<trans-unit id="MarshallingStringOrCharAsUndefinedNotSupported">
- <source>Marshalling string or char without explicit marshalling information is not supported. Specify 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
- <target state="translated">Le marshaling de chaîne ou de char sans informations de marshaling explicites n’est pas pris en charge. Spécifiez « LibraryImportAttribute.StringMars streaming », « LibraryImportAttribute.StringMars streamingCustomType », « MarshalUsingAttribute » ou « MarshalAsAttribute ».</target>
+ <source>Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
+ <target state="new">Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="RuntimeMarshallingMustBeDisabled">
<note />
</trans-unit>
<trans-unit id="MarshallingStringOrCharAsUndefinedNotSupported">
- <source>Marshalling string or char without explicit marshalling information is not supported. Specify 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
- <target state="translated">Il marshalling di stringa o carattere senza informazioni di marshalling esplicite non è supportato. Specificare 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' o 'MarshalAsAttribute'.</target>
+ <source>Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
+ <target state="new">Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="RuntimeMarshallingMustBeDisabled">
<note />
</trans-unit>
<trans-unit id="MarshallingStringOrCharAsUndefinedNotSupported">
- <source>Marshalling string or char without explicit marshalling information is not supported. Specify 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
- <target state="translated">明示的なマーシャリング情報を含まない文字列または文字のマーシャリングはサポートされていません。'LibraryImportAttribute.StringMarstailing'、'LibraryImportAttribute.StringMarshallingCustomType'、'MarshalUsingAttribute' または 'MarshalAsAttribute' を指定します。</target>
+ <source>Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
+ <target state="new">Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="RuntimeMarshallingMustBeDisabled">
<note />
</trans-unit>
<trans-unit id="MarshallingStringOrCharAsUndefinedNotSupported">
- <source>Marshalling string or char without explicit marshalling information is not supported. Specify 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
- <target state="translated">명시적 마샬링 정보 없이 문자열 또는 문자를 마샬링할 수 없습니다. 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' 또는 'MarshalAsAttribute'를 지정합니다.</target>
+ <source>Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
+ <target state="new">Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="RuntimeMarshallingMustBeDisabled">
<note />
</trans-unit>
<trans-unit id="MarshallingStringOrCharAsUndefinedNotSupported">
- <source>Marshalling string or char without explicit marshalling information is not supported. Specify 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
- <target state="translated">Ciągu lub znak marshallingu bez jawnych informacji o marshallingu nie jest obsługiwany. Określ atrybuty „LibraryImportAttribute.StringMarshalling”, „LibraryImportAttribute.StringMarshallingCustomType”, „MarshalUsingAttribute” lub „MarshalAsAttribute”.</target>
+ <source>Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
+ <target state="new">Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="RuntimeMarshallingMustBeDisabled">
<note />
</trans-unit>
<trans-unit id="MarshallingStringOrCharAsUndefinedNotSupported">
- <source>Marshalling string or char without explicit marshalling information is not supported. Specify 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
- <target state="translated">A cadeia de caracteres de marshalling ou char sem informações explícitas de marshalling não é suportado. Especifique 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' ou 'MarshalAsAttribute'.</target>
+ <source>Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
+ <target state="new">Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="RuntimeMarshallingMustBeDisabled">
<note />
</trans-unit>
<trans-unit id="MarshallingStringOrCharAsUndefinedNotSupported">
- <source>Marshalling string or char without explicit marshalling information is not supported. Specify 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
- <target state="translated">Строка или символ со строкой или символом без явных сведений о маршалинге не поддерживаются. Укажите \"LibraryImportAttribute.StringMarsing\", \"LibraryImportAttribute.StringMarsingCustomType\", \"MarshalUsingAttribute\" или \"MarshalAsAttribute\".</target>
+ <source>Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
+ <target state="new">Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="RuntimeMarshallingMustBeDisabled">
<note />
</trans-unit>
<trans-unit id="MarshallingStringOrCharAsUndefinedNotSupported">
- <source>Marshalling string or char without explicit marshalling information is not supported. Specify 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
- <target state="translated">Açık sıralama bilgileri olmadan dize veya karakter sıralama desteklenmiyor. 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' veya 'MarshalAsAttribute' belirtin.</target>
+ <source>Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
+ <target state="new">Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="RuntimeMarshallingMustBeDisabled">
<note />
</trans-unit>
<trans-unit id="MarshallingStringOrCharAsUndefinedNotSupported">
- <source>Marshalling string or char without explicit marshalling information is not supported. Specify 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
- <target state="translated">不支持封送没有显式封送信息的字符串或字符。请指定 \"LibraryImportAttribute.StringMarshalling\"、 \"LibraryImportAttribute.StringMarshallingCustomType\"、\"MarshalUsingAttribute\" 或 \"MarshalAsAttribute\"。</target>
+ <source>Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
+ <target state="new">Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="RuntimeMarshallingMustBeDisabled">
<note />
</trans-unit>
<trans-unit id="MarshallingStringOrCharAsUndefinedNotSupported">
- <source>Marshalling string or char without explicit marshalling information is not supported. Specify 'LibraryImportAttribute.StringMarshalling', 'LibraryImportAttribute.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
- <target state="translated">不支援在未明確封送處理資訊的情況下封送處理字串或字元。請指定 'LibraryImportAttribute.StringMarshalling'、'LibraryImportAttribute.StringMarshallingCustomType'、'MarshalUsingAttribute' 或 'MarshalAsAttribute'。</target>
+ <source>Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</source>
+ <target state="new">Marshalling string or char without explicit marshalling information is not supported. Specify '{0}.StringMarshalling', '{0}.StringMarshallingCustomType', 'MarshalUsingAttribute' or 'MarshalAsAttribute'.</target>
<note />
</trans-unit>
<trans-unit id="RuntimeMarshallingMustBeDisabled">
{
public const string DllImportAttribute = "System.Runtime.InteropServices.DllImportAttribute";
public const string LibraryImportAttribute = "System.Runtime.InteropServices.LibraryImportAttribute";
+ public const string LibraryImportAttribute_ShortName = "LibraryImportAttribute";
public const string StringMarshalling = "System.Runtime.InteropServices.StringMarshalling";
public const string NativeMarshallingAttribute = "System.Runtime.InteropServices.Marshalling.NativeMarshallingAttribute";
public const string System_Runtime_InteropServices_ComImportAttribute = "System.Runtime.InteropServices.ComImportAttribute";
public const string VirtualMethodIndexAttribute = "System.Runtime.InteropServices.Marshalling.VirtualMethodIndexAttribute";
+ public const string VirtualMethodIndexAttribute_ShortName = "VirtualMethodIndexAttribute";
public const string IUnmanagedVirtualMethodTableProvider = "System.Runtime.InteropServices.Marshalling.IUnmanagedVirtualMethodTableProvider";
public const string System_Runtime_CompilerServices_RuntimeHelpers = "System.Runtime.CompilerServices.RuntimeHelpers";
public const string GeneratedComInterfaceAttribute = "System.Runtime.InteropServices.Marshalling.GeneratedComInterfaceAttribute";
+ public const string GeneratedComInterfaceAttribute_ShortName = "GeneratedComInterfaceAttribute";
public const string InterfaceTypeAttribute = "System.Runtime.InteropServices.InterfaceTypeAttribute";
static void VerifyCompilation(Compilation comp)
{
- Assert.True(comp.GetTypeByMetadataName("Test.IFoo")
+ Assert.True(comp.GetTypeByMetadataName("Test.IDerivedIface")
?.GetMembers()
.Where(m => m.Kind == SymbolKind.Method && m.Name == "Bar")
.SingleOrDefault()