286 references to TypeNames
Microsoft.Interop.ComInterfaceGenerator (88)
Analyzers\AddGeneratedComClassAnalyzer.cs (2)
25var generatedComClassAttributeType = context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComClassAttribute); 26var generatedComInterfaceAttributeType = context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComInterfaceAttribute);
Analyzers\AddGeneratedComClassFixer.cs (2)
33var attribute = gen.Attribute(gen.TypeExpression(editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComClassAttribute)).WithAdditionalAnnotations(Simplifier.AddImportsAnnotation)); 47var comVisibleAttributeType = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.System_Runtime_InteropServices_ComVisibleAttribute);
Analyzers\AddMarshalAsToElementFixer.cs (2)
52TypeNames.System_Runtime_InteropServices_MarshalAsAttribute, 55gen.DottedName(TypeNames.System_Runtime_InteropServices_UnmanagedType),
Analyzers\ComClassGeneratorDiagnosticsAnalyzer.cs (2)
32INamedTypeSymbol? generatedComClassAttributeType = context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComClassAttribute); 38? context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComInterfaceAttribute)
Analyzers\ComHostingDoesNotSupportGeneratedComInterfaceAnalyzer.cs (3)
32INamedTypeSymbol? generatedComClassAttribute = context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComClassAttribute); 33INamedTypeSymbol? generatedComInterfaceAttribute = context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComInterfaceAttribute); 34INamedTypeSymbol? comVisibleAttribute = context.Compilation.GetBestTypeByMetadataName(TypeNames.System_Runtime_InteropServices_ComVisibleAttribute)!;
Analyzers\ComInterfaceGeneratorDiagnosticsAnalyzer.cs (1)
75INamedTypeSymbol? generatedComInterfaceAttrType = compilationContext.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComInterfaceAttribute);
Analyzers\ConvertComImportToGeneratedComInterfaceAnalyzer.cs (3)
36INamedTypeSymbol? interfaceTypeAttribute = context.Compilation.GetBestTypeByMetadataName(TypeNames.InterfaceTypeAttribute)!; 37INamedTypeSymbol? generatedComInterfaceAttribute = context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComInterfaceAttribute); 80AttributeData comImportAttribute = type.GetAttributes().First(attr => attr.AttributeClass.ToDisplayString() == TypeNames.System_Runtime_InteropServices_ComImportAttribute);
Analyzers\ConvertComImportToGeneratedComInterfaceFixer.cs (4)
82var generatedComInterfaceAttribute = gen.Attribute(gen.TypeExpression(comp.GetTypeByMetadataName(TypeNames.GeneratedComInterfaceAttribute)).WithAdditionalAnnotations(Simplifier.AddImportsAnnotation)); 90gen.AttributeArgument("StringMarshalling", gen.MemberAccessExpression(gen.DottedName(TypeNames.StringMarshalling), gen.IdentifierName(nameof(StringMarshalling.Custom)))), 91gen.AttributeArgument("StringMarshallingCustomType", gen.TypeOfExpression(gen.TypeExpression(comp.GetTypeByMetadataName(TypeNames.BStrStringMarshaller)))) 101var comImportAttributeType = comp.GetTypeByMetadataName(TypeNames.System_Runtime_InteropServices_ComImportAttribute);
Analyzers\GeneratedComInterfaceAttributeAnalyzer.cs (5)
40if (GetAttribute(typeSymbol, TypeNames.GeneratedComInterfaceAttribute, out _) 41&& GetAttribute(typeSymbol, TypeNames.InterfaceTypeAttribute, out AttributeData? comInterfaceAttribute) 62case TypeNames.ComInterfaceType: 65case TypeNames.System_Int16: 66case TypeNames.@short:
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (4)
29INamedTypeSymbol? marshalType = context.Compilation.GetBestTypeByMetadataName(TypeNames.System_Runtime_InteropServices_Marshal); 30INamedTypeSymbol? generatedComClassAttribute = context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComClassAttribute); 31INamedTypeSymbol? generatedComInterfaceAttribute = context.Compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComInterfaceAttribute); 32INamedTypeSymbol? comObjectType = context.Compilation.GetBestTypeByMetadataName(TypeNames.System_Runtime_InteropServices_Marshalling_ComObject);
Analyzers\VtableIndexStubDiagnosticsAnalyzer.cs (2)
45INamedTypeSymbol? virtualMethodIndexAttrType = compilationContext.Compilation.GetBestTypeByMetadataName(TypeNames.VirtualMethodIndexAttribute); 135if (!method.ContainingType.GetAttributes().Any(att => att.AttributeClass.IsOfType(TypeNames.UnmanagedObjectUnwrapperAttribute)))
ComClassGenerator.cs (2)
23TypeNames.GeneratedComClassAttribute, 31INamedTypeSymbol? generatedComInterfaceAttributeType = compilation.GetBestTypeByMetadataName(TypeNames.GeneratedComInterfaceAttribute);
ComInterfaceGenerator.cs (6)
27TypeNames.GeneratedComInterfaceAttribute, 160return (HintName: interfaceContext.Info.Type.FullTypeName.Replace(TypeNames.GlobalAlias, "").Replace("@", ""), Source: writer.ToString()); 214generatorDiagnostics.ReportConfigurationNotSupported(lcidConversionAttr, nameof(TypeNames.LCIDConversionAttribute)); 300environment.Compilation.GetTypeByMetadataName(TypeNames.System_Exception), 975if (attrInfo.Type is "global::" + TypeNames.MarshalUsingAttribute 976or "global::" + TypeNames.System_Runtime_InteropServices_MarshalAsAttribute)
ComInterfaceGeneratorHelpers.cs (1)
17=> DefaultMarshallingGeneratorResolver.Create(env, direction, TypeNames.GeneratedComInterfaceAttribute_ShortName,
ComInterfaceInfo.cs (5)
240attrInfo.StringMarshallingCustomType.FullTypeName.Replace(TypeNames.GlobalAlias, ""), 322exceptionToUnmanagedMarshallerType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat).Replace(TypeNames.GlobalAlias, ""), 349if (attr.AttributeClass?.ToDisplayString() == TypeNames.GeneratedComInterfaceAttribute) 384if (attrDisplayString is TypeNames.System_Runtime_InteropServices_GuidAttribute) 386else if (attrDisplayString is TypeNames.InterfaceTypeAttribute)
ComMethodInfo.cs (3)
562if (attr.AttributeClass?.ToDisplayString() == TypeNames.MarshalUsingAttribute 625if (attrName != TypeNames.MarshalUsingAttribute 626&& attrName != TypeNames.System_Runtime_InteropServices_MarshalAsAttribute)
GeneratedComInterfaceAttributeData.cs (2)
46&& attr.AttributeClass?.ToDisplayString() == TypeNames.GeneratedComInterfaceAttribute) 63Debug.Assert(attr.AttributeClass.ToDisplayString() == TypeNames.GeneratedComInterfaceAttribute);
Marshallers\ComInterfaceDispatchMarshallingResolver.cs (5)
31$"{TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_ComWrappers_ComInterfaceDispatch}*", 32$"{TypeNames.System_Runtime_InteropServices_ComWrappers_ComInterfaceDispatch}*", 43writer.WriteLine($"{managed} = {TypeNames.GlobalAlias}{TypeNames.System_Runtime_InteropServices_ComWrappers_ComInterfaceDispatch}.GetInstance<{info.ManagedType.FullTypeName}>({native});");
Marshallers\KeepAliveThisMarshaller.cs (2)
18writer.WriteLine($"{TypeNames.GlobalAlias}{TypeNames.System_GC}.KeepAlive(this);");
Marshallers\ManagedHResultExceptionGeneratorResolver.cs (2)
45writer.WriteLine($"{TypeNames.GlobalAlias}{TypeNames.System_Runtime_InteropServices_Marshal}.ThrowExceptionForHR({managedIdentifier}, new({interfaceId}), (nint){VirtualMethodPointerStubGenerator.NativeThisParameterIdentifier});");
Marshallers\ObjectUnwrapperResolver.cs (2)
40writer.WriteLine($"{managedIdentifier} = ({info.ManagedType.FullTypeName}){TypeNames.GlobalAlias}{TypeNames.UnmanagedObjectUnwrapper}.GetObjectForUnmanagedWrapper<{unwrapperType}>({nativeIdentifier});");
Marshallers\StructAsHResultMarshallerFactory.cs (4)
36writer.WriteLine($"{unmanaged} = {TypeNames.GlobalAlias}{TypeNames.System_Runtime_CompilerServices_Unsafe}.BitCast<{info.ManagedType.FullTypeName}, {AsNativeType(info).FullTypeName}>({managed});"); 42writer.WriteLine($"{managed} = {TypeNames.GlobalAlias}{TypeNames.System_Runtime_CompilerServices_Unsafe}.BitCast<{AsNativeType(info).FullTypeName}, {info.ManagedType.FullTypeName}>({unmanaged});");
parent\Common\ConvertToSourceGeneratedInteropFixer.cs (7)
241&& !parameter.GetAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute)) 250&& !methodSymbol.GetReturnTypeAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute)) 260=> generator.Attribute(TypeNames.System_Runtime_InteropServices_MarshalAsAttribute, 263generator.DottedName(TypeNames.System_Runtime_InteropServices_UnmanagedType), 271&& !methodSymbol.GetReturnTypeAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute)) 289=> generator.Attribute(TypeNames.System_Runtime_InteropServices_MarshalAsAttribute, 292generator.DottedName(TypeNames.System_Runtime_InteropServices_UnmanagedType),
VirtualMethodPointerStubGenerator.cs (7)
45writer.WriteLine($"var ({NativeThisParameterIdentifier}, {VirtualMethodTableIdentifier}) = (({TypeNames.GlobalAlias}{TypeNames.IUnmanagedVirtualMethodTableProvider})this).GetVirtualMethodTableInfoForKey(typeof({methodStub.TypeKeyOwner.FullTypeName}));"); 100string unmanagedCallersOnlyAttribute = TypeNames.GlobalAlias + TypeNames.UnmanagedCallersOnlyAttribute; 178new ReferenceTypeInfo(TypeNames.GlobalAlias + TypeNames.System_Exception, TypeNames.System_Exception),
VtableIndexStubGenerator.cs (9)
27TypeNames.VirtualMethodIndexAttribute, 283INamedTypeSymbol? lcidConversionAttrType = environment.Compilation.GetTypeByMetadataName(TypeNames.LCIDConversionAttribute); 284INamedTypeSymbol? suppressGCTransitionAttrType = environment.Compilation.GetTypeByMetadataName(TypeNames.SuppressGCTransitionAttribute); 285INamedTypeSymbol? unmanagedCallConvAttrType = environment.Compilation.GetTypeByMetadataName(TypeNames.UnmanagedCallConvAttribute); 286INamedTypeSymbol iUnmanagedInterfaceTypeType = environment.Compilation.GetTypeByMetadataName(TypeNames.IUnmanagedInterfaceType_Metadata)!; 295&& attr.AttributeClass.ToDisplayString() == TypeNames.VirtualMethodIndexAttribute) 355generatorDiagnostics.ReportConfigurationNotSupported(lcidConversionAttr, nameof(TypeNames.LCIDConversionAttribute)); 387var unmanagedObjectUnwrapper = symbol.ContainingType.GetAttributes().FirstOrDefault(att => att.AttributeClass.IsOfType(TypeNames.UnmanagedObjectUnwrapperAttribute)); 441compilation.GetTypeByMetadataName(TypeNames.System_Exception),
VtableIndexStubGeneratorHelpers.cs (1)
19=> DefaultMarshallingGeneratorResolver.Create(env, direction, TypeNames.VirtualMethodIndexAttribute_ShortName,
Microsoft.Interop.JavaScript.JSImportGenerator (4)
Marshaling\BaseJSGenerator.cs (2)
38writer.WriteLine($"{TypeNames.GlobalAlias}{TypeNames.System_Runtime_CompilerServices_Unsafe}.SkipInit(out {js});");
Marshaling\ImplicitArgumentGenerator.cs (2)
13writer.WriteLine($"{TypeNames.GlobalAlias}{TypeNames.System_Runtime_CompilerServices_Unsafe}.SkipInit(out {js});");
Microsoft.Interop.LibraryImportGenerator (63)
Analyzers\AddDisableRuntimeMarshallingAttributeFixer.cs (1)
66editor.Generator.Attribute(editor.Generator.DottedName(TypeNames.System_Runtime_CompilerServices_DisableRuntimeMarshallingAttribute))));
Analyzers\ConvertToLibraryImportAnalyzer.cs (5)
55INamedTypeSymbol? libraryImportAttrType = context.Compilation.GetBestTypeByMetadataName(TypeNames.LibraryImportAttribute); 142AttributeData dllImportAttribute = method.GetAttributes().First(attr => attr.AttributeClass.ToDisplayString() == TypeNames.DllImportAttribute); 150var factory = new ByValueContentsMarshalKindValidator(DefaultMarshallingGeneratorResolver.Create(env.EnvironmentFlags, MarshalDirection.ManagedToUnmanaged, TypeNames.LibraryImportAttribute_ShortName, [])); 186AttributeData? bestFitMappingContainingType = method.ContainingType.GetAttributes().FirstOrDefault(attr => attr.AttributeClass.ToDisplayString() == TypeNames.System_Runtime_InteropServices_BestFitMappingAttribute); 192AttributeData? bestFitMappingContainingAssembly = method.ContainingAssembly.GetAttributes().FirstOrDefault(attr => attr.AttributeClass.ToDisplayString() == TypeNames.System_Runtime_InteropServices_BestFitMappingAttribute);
Analyzers\ConvertToLibraryImportFixer.cs (9)
217INamedTypeSymbol? dllImportAttrType = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.DllImportAttribute); 222INamedTypeSymbol libraryImportAttrType = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.LibraryImportAttribute)!; 426TypeNames.System_Runtime_InteropServices_Marshal)), 477ITypeSymbol stringMarshallingType = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.StringMarshalling)!; 486ITypeSymbol stringMarshallingType = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.StringMarshalling)!; 494generator.TypeOfExpression(generator.TypeExpression(editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.AnsiStringMarshaller))))); 598if (editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.UnmanagedCallConvAttribute) is null) 641generator.TypeExpression(editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.System_Type)), 644unmanagedCallConvAttribute = generator.Attribute(TypeNames.UnmanagedCallConvAttribute,
Analyzers\CustomMarshallerAttributeAnalyzer.cs (3)
621if (context.Compilation.GetBestTypeByMetadataName(TypeNames.CustomMarshallerAttribute) is { } customMarshallerAttribute) 639_spanOfT = compilation.GetBestTypeByMetadataName(TypeNames.System_Span_Metadata); 640_readOnlySpanOfT = compilation.GetBestTypeByMetadataName(TypeNames.System_ReadOnlySpan_Metadata);
Analyzers\CustomMarshallerAttributeFixer.cs (4)
209INamedTypeSymbol spanOfT = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.System_Span_Metadata)!; 210INamedTypeSymbol readOnlySpanOfT = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.System_ReadOnlySpan_Metadata)!; 405INamedTypeSymbol spanOfT = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.System_Span_Metadata)!; 406INamedTypeSymbol readOnlySpanOfT = editor.SemanticModel.Compilation.GetBestTypeByMetadataName(TypeNames.System_ReadOnlySpan_Metadata)!;
Analyzers\LibraryImportDiagnosticsAnalyzer.cs (3)
56INamedTypeSymbol? libraryImportAttrType = context.Compilation.GetBestTypeByMetadataName(TypeNames.LibraryImportAttribute); 283generatorDiagnostics.ReportConfigurationNotSupported(attr, nameof(TypeNames.LCIDConversionAttribute)); 306TypeNames.LibraryImportAttribute_ShortName,
Analyzers\NativeMarshallingAttributeAnalyzer.cs (1)
88&& attrCreation.Type.ToDisplayString() == TypeNames.NativeMarshallingAttribute)
Analyzers\ShapeBreakingDiagnosticSuppressor.cs (1)
61attr => attr.AttributeClass?.ToDisplayString() == TypeNames.CustomMarshallerAttribute
ErrorHandlingInfoParser.cs (7)
18if (candidate.AttributeClass?.ToDisplayString() == TypeNames.ErrorHandlerAttribute) 22diagnostics.ReportConfigurationNotSupported(candidate, nameof(TypeNames.ErrorHandlerAttribute)); 41diagnostics.ReportConfigurationNotSupported(attribute, nameof(TypeNames.ErrorHandlerAttribute)); 47diagnostics.ReportConfigurationNotSupported(attribute, nameof(TypeNames.ErrorHandlerAttribute)); 56diagnostics.ReportConfigurationNotSupported(attribute, nameof(TypeNames.ErrorHandlerAttribute)); 65diagnostics.ReportConfigurationNotSupported(attribute, nameof(TypeNames.ErrorHandlerAttribute)); 78diagnostics.ReportConfigurationNotSupported(attribute, nameof(TypeNames.ErrorHandlerAttribute));
LibraryImportGenerator.cs (22)
46TypeNames.LibraryImportAttribute, 93attributes.Add(TypeNames.GlobalAlias + TypeNames.SuppressGCTransitionAttribute); 98attributes.Add(TypeNames.GlobalAlias + TypeNames.System_Diagnostics_StackTraceHiddenAttribute); 103attributes.Add(TypeNames.GlobalAlias + TypeNames.System_Diagnostics_DebuggerHiddenAttribute); 108string unmanagedCallConv = TypeNames.GlobalAlias + TypeNames.UnmanagedCallConvAttribute; 120unmanagedCallConv += $"({CallConvsField} = new {TypeNames.GlobalAlias}{TypeNames.System_Type}[] {initializer})"; 128attributes.Add($"{TypeNames.GlobalAlias}{TypeNames.DefaultDllImportSearchPathsAttribute}(({TypeNames.GlobalAlias}{TypeNames.DllImportSearchPath}){searchPaths})"); 132attributes.Add(TypeNames.GlobalAlias + TypeNames.WasmImportLinkageAttribute); 224&& attr.AttributeClass.ToDisplayString() == TypeNames.LibraryImportAttribute) 306: DefaultMarshallingGeneratorResolver.Create(pinvokeStub.EnvironmentFlags, MarshalDirection.ManagedToUnmanaged, TypeNames.LibraryImportAttribute_ShortName, []); 380return $"{TypeNames.GlobalAlias}{TypeNames.DllImportAttribute}({string.Join(", ", arguments)})"; 384=> $"{TypeNames.GlobalAlias}{typeof(T).FullName}.{value}";
parent\Common\ConvertToSourceGeneratedInteropFixer.cs (7)
241&& !parameter.GetAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute)) 250&& !methodSymbol.GetReturnTypeAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute)) 260=> generator.Attribute(TypeNames.System_Runtime_InteropServices_MarshalAsAttribute, 263generator.DottedName(TypeNames.System_Runtime_InteropServices_UnmanagedType), 271&& !methodSymbol.GetReturnTypeAttributes().Any(attr => attr.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute)) 289=> generator.Attribute(TypeNames.System_Runtime_InteropServices_MarshalAsAttribute, 292generator.DottedName(TypeNames.System_Runtime_InteropServices_UnmanagedType),
Microsoft.Interop.LibraryImportGenerator.Downlevel (14)
DownlevelLibraryImportDiagnosticsAnalyzer.cs (3)
50INamedTypeSymbol? libraryImportAttrType = context.Compilation.GetBestTypeByMetadataName(TypeNames.LibraryImportAttribute); 281generatorDiagnostics.ReportConfigurationNotSupported(attr, nameof(TypeNames.LCIDConversionAttribute)); 314$"{nameof(TypeNames.LibraryImportAttribute)}{Type.Delimiter}{nameof(StringMarshalling)}",
DownlevelLibraryImportGenerator.cs (9)
79TypeNames.LibraryImportAttribute, 119attributes.Add($"{TypeNames.GlobalAlias}{TypeNames.DefaultDllImportSearchPathsAttribute}(({TypeNames.GlobalAlias}{TypeNames.DllImportSearchPath}){searchPaths})"); 200&& attr.AttributeClass.ToDisplayString() == TypeNames.LibraryImportAttribute) 326return $"{TypeNames.GlobalAlias}{TypeNames.DllImportAttribute}({string.Join(", ", arguments)})"; 330=> $"{TypeNames.GlobalAlias}{typeof(T).FullName}.{value}";
DownlevelLibraryImportGeneratorHelpers.cs (2)
52new NoMarshallingInfoErrorResolver(TypeNames.LibraryImportAttribute_ShortName), 53new CharMarshallingGeneratorResolver(useBlittableMarshallerForUtf16: false, TypeNames.LibraryImportAttribute_ShortName),
Microsoft.Interop.SourceGeneration (117)
ArrayMarshallingInfoProvider.cs (2)
51arrayMarshaller = compilation.GetTypeByMetadataName(TypeNames.System_Runtime_InteropServices_PointerArrayMarshaller_Metadata); 56arrayMarshaller = compilation.GetTypeByMetadataName(TypeNames.System_Runtime_InteropServices_ArrayMarshaller_Metadata);
ComInterfaceMarshallingInfoProvider.cs (3)
25public bool CanParseAttributeType(INamedTypeSymbol attributeType) => attributeType.ToDisplayString() == TypeNames.GeneratedComInterfaceAttribute; 37INamedTypeSymbol? comInterfaceMarshaller = compilation.GetTypeByMetadataName(TypeNames.System_Runtime_InteropServices_Marshalling_ComInterfaceMarshaller_Metadata); 139if (attr.AttributeClass?.ToDisplayString() != TypeNames.GeneratedComInterfaceAttribute)
CompilationExtensions.cs (2)
17if (compilation.SourceModule.GetAttributes().Any(attr => attr.AttributeClass.ToDisplayString() == TypeNames.System_Runtime_CompilerServices_SkipLocalsInitAttribute)) 21if (compilation.Assembly.GetAttributes().Any(attr => attr.AttributeClass.ToDisplayString() == TypeNames.System_Runtime_CompilerServices_DisableRuntimeMarshallingAttribute))
GeneratedStatements.cs (2)
145writer.WriteLine($"catch ({TypeNames.GlobalAlias}{TypeNames.System_Exception} {managed})");
IncrementalGeneratorInitializationContextExtensions.cs (2)
17TypeNames.System_Runtime_CompilerServices_SkipLocalsInitAttribute, 28TypeNames.System_Runtime_CompilerServices_DisableRuntimeMarshallingAttribute,
ManualTypeMarshallingHelper.cs (5)
113&& entryPointType.GetAttributes().Any(attr => attr.AttributeClass.ToDisplayString() == TypeNames.ContiguousCollectionMarshallerAttribute); 118return entryPointType.GetAttributes().Any(attr => attr.AttributeClass.ToDisplayString() == TypeNames.CustomMarshallerAttribute); 139if (attr.AttributeClass?.ToDisplayString() != TypeNames.CustomMarshallerAttribute 219var attrs = entryPointType.GetAttributes().Where(attr => attr.AttributeClass.ToDisplayString() == TypeNames.CustomMarshallerAttribute).ToArray(); 452if (innerType.ToDisplayString() != TypeNames.CustomMarshallerAttributeGenericPlaceholder)
MarshalAsParser.cs (10)
33writer.Write($"{TypeNames.GlobalAlias}{TypeNames.System_Runtime_InteropServices_MarshalAsAttribute}(({TypeNames.GlobalAlias}{TypeNames.System_Runtime_InteropServices_UnmanagedType}){(int)unmanagedType}"); 98writer.Write($", {nameof(ArraySubType)} = ({TypeNames.GlobalAlias}{TypeNames.System_Runtime_InteropServices_UnmanagedType}){(int)ArraySubType}"); 137public bool CanParseAttributeType(INamedTypeSymbol attributeType) => attributeType.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute; 258=> info.ManagedType.FullTypeName is TypeNames.System_Guid 259or $"{TypeNames.GlobalAlias}{TypeNames.System_Guid}";
MarshalAsWithCustomMarshallersParser.cs (6)
35public bool CanParseAttributeType(INamedTypeSymbol attributeType) => attributeType.ToDisplayString() == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute; 90return CustomMarshallingInfoHelper.CreateMarshallingInfoByMarshallerTypeName(_compilation, type, TypeNames.ComVariantMarshaller); 102UnmanagedType.BStr => TypeNames.BStrStringMarshaller, 103UnmanagedType.LPStr => TypeNames.AnsiStringMarshaller, 104UnmanagedType.LPTStr or UnmanagedType.LPWStr => TypeNames.Utf16StringMarshaller, 105MarshalAsInfo.UnmanagedType_LPUTF8Str => TypeNames.Utf8StringMarshaller,
MarshallerShape.cs (4)
116INamedTypeSymbol spanOfT = compilation.GetTypeByMetadataName(TypeNames.System_Span_Metadata)!; 120INamedTypeSymbol readOnlySpanOfT = compilation.GetTypeByMetadataName(TypeNames.System_ReadOnlySpan_Metadata)!; 454INamedTypeSymbol spanOfT = compilation.GetTypeByMetadataName(TypeNames.System_Span_Metadata)!; 459INamedTypeSymbol readOnlySpanOfT = compilation.GetTypeByMetadataName(TypeNames.System_ReadOnlySpan_Metadata)!;
Marshalling\BreakingChangeDetector.cs (1)
26if (info is { RefKind: RefKind.In or RefKind.RefReadOnlyParameter, MarshallingAttributeInfo: NativeMarshallingAttributeInfo(ManagedTypeInfo { DiagnosticFormattedName: TypeNames.ComVariantMarshaller }, _) }
Marshalling\DelegateMarshaller.cs (6)
35writer.WriteLine($"{nativeIdentifier} = {managedIdentifier} != null ? {TypeNames.GlobalAlias}{TypeNames.System_Runtime_InteropServices_Marshal}.GetFunctionPointerForDelegate({managedIdentifier}) : default;"); 42writer.WriteLine($"{managedIdentifier} = {nativeIdentifier} != default ? {TypeNames.GlobalAlias}{TypeNames.System_Runtime_InteropServices_Marshal}.GetDelegateForFunctionPointer<{info.ManagedType.FullTypeName}>({nativeIdentifier}) : null;"); 48writer.WriteLine($"{TypeNames.GlobalAlias}{TypeNames.System_GC}.KeepAlive({managedIdentifier});");
Marshalling\ElementsMarshalling.cs (15)
24protected const string MemoryMarshalType = TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_MemoryMarshal; 25protected const string UnsafeType = TypeNames.GlobalAlias + TypeNames.System_Runtime_CompilerServices_Unsafe; 159writer.WriteLine($"{TypeNames.System_ReadOnlySpan}<{elementMarshaller.TypeInfo.ManagedType.FullTypeName}> {managedSpanIdentifier} = {CollectionSource.GetManagedValuesSource(context)};"); 160writer.WriteLine($"{TypeNames.System_Span}<{unmanagedElementType}> {nativeSpanIdentifier} = {CollectionSource.GetUnmanagedValuesDestination(context)};"); 179writer.WriteLine($"{TypeNames.System_ReadOnlySpan}<{unmanagedElementType}> {nativeSpanIdentifier} = {CollectionSource.GetUnmanagedValuesSource(context)};"); 180writer.WriteLine($"{TypeNames.System_Span}<{elementMarshaller.TypeInfo.ManagedType.FullTypeName}> {managedSpanIdentifier} = {CollectionSource.GetManagedValuesDestination(context)};"); 196writer.WriteLine($"{TypeNames.System_Span}<{elementMarshaller.TypeInfo.ManagedType.FullTypeName}> {managedSpanIdentifier} = {MemoryMarshalType}.CreateSpan(ref {UnsafeType}.AsRef(in {CollectionSource.GetManagedValuesSource(context)}.GetPinnableReference()), {numElementsIdentifier});"); 197writer.WriteLine($"{TypeNames.System_Span}<{unmanagedElementType}> {nativeSpanIdentifier} = {CollectionSource.GetUnmanagedValuesDestination(context)};"); 227writer.WriteLine($"{TypeNames.System_ReadOnlySpan}<{unmanagedElementType}> {nativeSpanIdentifier} = {source};"); 253writer.WriteLine($"{TypeNames.System_Span}<{unmanagedElementType}> {nativeSpanIdentifier} = {MemoryMarshalType}.CreateSpan(ref {UnsafeType}.AsRef(in {CollectionSource.GetUnmanagedValuesSource(context)}.GetPinnableReference()), {numElementsIdentifier});"); 254writer.WriteLine($"{TypeNames.System_Span}<{elementMarshaller.TypeInfo.ManagedType.FullTypeName}> {managedSpanIdentifier} = {CollectionSource.GetManagedValuesDestination(context)};"); 315writer.WriteLine($"{elementSetupSubContext.GetIdentifiers(elementMarshaller.TypeInfo).native} = ({TypeNames.GlobalAlias}{TypeNames.System_IntPtr}){identifierContext.GetIdentifiers(elementMarshaller.TypeInfo).native};");
Marshalling\IidParameterIndexMarshallerResolver.cs (10)
50writer.WriteLine($"{TypeNames.GlobalAlias}{TypeNames.System_IntPtr} {queriedInterfaceIdentifier} = 0;"); 51writer.WriteLine($"int {queryInterfaceHResultIdentifier} = {TypeNames.GlobalAlias}{TypeNames.System_Runtime_InteropServices_Marshal}.QueryInterface(({TypeNames.GlobalAlias}{TypeNames.System_IntPtr}){unknownIdentifier}, in {iidExpression}, out {queriedInterfaceIdentifier});"); 59writer.WriteLine($"{TypeNames.GlobalAlias}{TypeNames.System_Runtime_InteropServices_Marshal}.Release({queriedInterfaceIdentifier});"); 63writer.WriteLine($"{TypeNames.GlobalAlias}{TypeNames.System_Runtime_InteropServices_Marshal}.ThrowExceptionForHR({queryInterfaceHResultIdentifier});");
Marshalling\MarshallerHelpers.cs (10)
28? TypeNames.GlobalAlias + TypeNames.System_IntPtr 37FormattableString.Invariant($"{TypeNames.GlobalAlias}{TypeNames.System_Runtime_InteropServices_Marshal}.SetLastSystemError({errorCode});"); 43$"{lastErrorIdentifier} = {TypeNames.GlobalAlias}{TypeNames.System_Runtime_InteropServices_Marshal}.GetLastSystemError();"; 50$"{TypeNames.GlobalAlias}{TypeNames.System_Runtime_InteropServices_Marshal}.SetLastPInvokeError({lastErrorIdentifier});"; 227return $"{TypeNames.GlobalAlias}{TypeNames.System_Runtime_CompilerServices_Unsafe}.SkipInit(out {info.InstanceIdentifier});";
Marshalling\MarshallingGeneratorExtensions.cs (4)
102attributes.Add(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_InAttribute); 106attributes.Add(TypeNames.GlobalAlias + TypeNames.System_Runtime_InteropServices_OutAttribute);
Marshalling\StatelessMarshallingStrategy.cs (1)
107writer.WriteLine($"{TypeNames.System_Span}<{bufferElementType}> {bufferIdentifier} = stackalloc {bufferElementType}[{marshallerType}.{ShapeMemberNames.BufferSize}];");
MarshallingAttributeInfo.cs (7)
173SpecialType.System_Void => CreateWellKnownComExceptionMarshallingData(TypeNames.ExceptionAsVoidMarshaller, unmanagedReturnType), 174SpecialType.System_Int32 => CreateWellKnownComExceptionMarshallingData($"{TypeNames.ExceptionAsHResultMarshaller}<int>", unmanagedReturnType), 175SpecialType.System_UInt32 => CreateWellKnownComExceptionMarshallingData($"{TypeNames.ExceptionAsHResultMarshaller}<uint>", unmanagedReturnType), 176SpecialType.System_Single => CreateWellKnownComExceptionMarshallingData($"{TypeNames.ExceptionAsNaNMarshaller}<float>", unmanagedReturnType), 177SpecialType.System_Double => CreateWellKnownComExceptionMarshallingData($"{TypeNames.ExceptionAsNaNMarshaller}<double>", unmanagedReturnType), 178_ => CreateWellKnownComExceptionMarshallingData($"{TypeNames.ExceptionAsDefaultMarshaller}<{MarshallerHelpers.GetCompatibleGenericTypeParameter(unmanagedReturnType)}>", unmanagedReturnType), 183ManagedTypeInfo marshallerTypeInfo = new ReferenceTypeInfo(TypeNames.GlobalAlias + marshallerName, marshallerName);
MarshalUsingAttributeParser.cs (2)
26public bool CanParseAttributeType(INamedTypeSymbol attributeType) => attributeType.ToDisplayString() == TypeNames.MarshalUsingAttribute; 30Debug.Assert(attributeData.AttributeClass!.ToDisplayString() == TypeNames.MarshalUsingAttribute);
NativeMarshallingAttributeParser.cs (2)
20public bool CanParseAttributeType(INamedTypeSymbol attributeType) => attributeType.ToDisplayString() == TypeNames.NativeMarshallingAttribute; 24Debug.Assert(attributeData.AttributeClass!.ToDisplayString() == TypeNames.NativeMarshallingAttribute);
SafeHandleMarshallingInfoProvider.cs (2)
18private readonly INamedTypeSymbol? _safeHandleType = compilation.GetBestTypeByMetadataName(TypeNames.System_Runtime_InteropServices_SafeHandle); 19private readonly INamedTypeSymbol? _safeHandleMarshallerType = compilation.GetBestTypeByMetadataName(TypeNames.System_Runtime_InteropServices_Marshalling_SafeHandleMarshaller_Metadata);
SignatureContext.cs (6)
78additionalAttrs.Add($"{TypeNames.GlobalAlias}{TypeNames.System_CodeDom_Compiler_GeneratedCodeAttribute}({CodeWriterHelpers.StringLiteral(generatorName)}, {CodeWriterHelpers.StringLiteral(generatorVersion)})"); 82additionalAttrs.Add(TypeNames.GlobalAlias + TypeNames.System_Runtime_CompilerServices_SkipLocalsInitAttribute); 286if (attributeName == TypeNames.MarshalUsingAttribute) 340=> a.AttributeClass?.ToDisplayString() == TypeNames.System_Runtime_CompilerServices_SkipLocalsInitAttribute;
StringMarshallingInfoProvider.cs (2)
62CharEncoding.Utf16 => CustomMarshallingInfoHelper.CreateMarshallingInfoByMarshallerTypeName(_compilation, type, TypeNames.Utf16StringMarshaller), 63CharEncoding.Utf8 => CustomMarshallingInfoHelper.CreateMarshallingInfoByMarshallerTypeName(_compilation, type, TypeNames.Utf8StringMarshaller),
StubEnvironment.cs (7)
35_lcidConversionAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.LCIDConversionAttribute)); 49_suppressGCTransitionAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.SuppressGCTransitionAttribute)); 63_unmanagedCallConvAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.UnmanagedCallConvAttribute)); 77_defaultDllImportSearchPathsAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.DefaultDllImportSearchPathsAttribute)); 91_wasmImportLinkageAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.WasmImportLinkageAttribute)); 105_stackTraceHiddenAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.System_Diagnostics_StackTraceHiddenAttribute)); 119_debuggerHiddenAttrType = new Optional<INamedTypeSymbol?>(Compilation.GetTypeByMetadataName(TypeNames.System_Diagnostics_DebuggerHiddenAttribute));
TypePositionInfo.cs (2)
114INamedTypeSymbol outAttributeType = compilation.GetTypeByMetadataName(TypeNames.System_Runtime_InteropServices_OutAttribute)!; 115INamedTypeSymbol inAttributeType = compilation.GetTypeByMetadataName(TypeNames.System_Runtime_InteropServices_InAttribute)!;
TypeSymbolExtensions.cs (4)
74if (t.ToDisplayString() is TypeNames.System_Runtime_InteropServices_CLong // CLong is an interop intrinsic type for the C long type 75or TypeNames.System_Runtime_InteropServices_CULong // CULong is an interop intrinsic type for the C ulong type 76or TypeNames.System_Runtime_InteropServices_NFloat) // NFloat is an interop intrinsic type for a pointer-sized floating point type 83if (t.ToDisplayString() == TypeNames.System_Guid) // .NET has established that Guid is blittable and matches the shape of the Win32 GUID type exactly and always will.