176 references to MethodImportAttributes
ILCompiler.TypeSystem (24)
parent\parent\Common\TypeSystem\Ecma\EcmaMethod.cs (24)
480MethodImportAttributes importAttributes = import.Attributes; 484if ((importAttributes & MethodImportAttributes.BestFitMappingMask) == 0 || 485(importAttributes & MethodImportAttributes.ThrowOnUnmappableCharMask) == 0) 490MethodImportAttributes fromCA = GetImportAttributesFromBestFitMappingAttribute(declaringType.GetCustomAttributes()); 491if ((importAttributes & MethodImportAttributes.BestFitMappingMask) == 0) 492importAttributes |= fromCA & MethodImportAttributes.BestFitMappingMask; 493if ((importAttributes & MethodImportAttributes.ThrowOnUnmappableCharMask) == 0) 494importAttributes |= fromCA & MethodImportAttributes.ThrowOnUnmappableCharMask; 497if ((importAttributes & MethodImportAttributes.BestFitMappingMask) == 0 || 498(importAttributes & MethodImportAttributes.ThrowOnUnmappableCharMask) == 0) 501if ((importAttributes & MethodImportAttributes.BestFitMappingMask) == 0) 502importAttributes |= fromCA & MethodImportAttributes.BestFitMappingMask; 503if ((importAttributes & MethodImportAttributes.ThrowOnUnmappableCharMask) == 0) 504importAttributes |= fromCA & MethodImportAttributes.ThrowOnUnmappableCharMask; 509Debug.Assert((int)MethodImportAttributes.CallingConventionStdCall == (int)PInvokeAttributes.CallingConventionStdCall); 510Debug.Assert((int)MethodImportAttributes.CharSetAuto == (int)PInvokeAttributes.CharSetAuto); 511Debug.Assert((int)MethodImportAttributes.CharSetUnicode == (int)PInvokeAttributes.CharSetUnicode); 512Debug.Assert((int)MethodImportAttributes.SetLastError == (int)PInvokeAttributes.SetLastError); 522private MethodImportAttributes GetImportAttributesFromBestFitMappingAttribute(CustomAttributeHandleCollection attributeHandles) 527MethodImportAttributes result = 0; 541result |= MethodImportAttributes.BestFitMappingEnable; 543result |= MethodImportAttributes.BestFitMappingDisable; 552result |= MethodImportAttributes.ThrowOnUnmappableCharEnable; 554result |= MethodImportAttributes.ThrowOnUnmappableCharDisable;
Microsoft.CodeAnalysis (40)
MetadataReader\PEModule.cs (2)
3449MethodImportAttributes flags = (MethodImportAttributes)methodImport.Attributes;
PEWriter\Miscellaneous.cs (1)
237MethodImportAttributes Flags { get; }
Symbols\Attributes\CommonMethodWellKnownAttributeData.cs (1)
65public void SetDllImport(int attributeIndex, string? moduleName, string? entryPointName, MethodImportAttributes flags, bool preserveSig)
Symbols\PlatformInvokeInformation.cs (36)
18private readonly MethodImportAttributes _flags; 20internal DllImportData(string? moduleName, string? entryPointName, MethodImportAttributes flags) 43MethodImportAttributes Cci.IPlatformInvokeInformation.Flags 56return (_flags & MethodImportAttributes.ExactSpelling) != 0; 67switch (_flags & MethodImportAttributes.CharSetMask) 69case MethodImportAttributes.CharSetAnsi: 72case MethodImportAttributes.CharSetUnicode: 75case MethodImportAttributes.CharSetAuto: 93return (_flags & MethodImportAttributes.SetLastError) != 0; 104switch (_flags & MethodImportAttributes.CallingConventionMask) 109case MethodImportAttributes.CallingConventionCDecl: 112case MethodImportAttributes.CallingConventionStdCall: 115case MethodImportAttributes.CallingConventionThisCall: 118case MethodImportAttributes.CallingConventionFastCall: 132switch (_flags & MethodImportAttributes.BestFitMappingMask) 134case MethodImportAttributes.BestFitMappingEnable: 137case MethodImportAttributes.BestFitMappingDisable: 154switch (_flags & MethodImportAttributes.ThrowOnUnmappableCharMask) 156case MethodImportAttributes.ThrowOnUnmappableCharEnable: 159case MethodImportAttributes.ThrowOnUnmappableCharDisable: 168internal static MethodImportAttributes MakeFlags(bool exactSpelling, CharSet charSet, bool setLastError, CallingConvention callingConvention, bool? useBestFit, bool? throwOnUnmappable) 170MethodImportAttributes result = 0; 173result |= MethodImportAttributes.ExactSpelling; 179result |= MethodImportAttributes.CharSetAnsi; 183result |= MethodImportAttributes.CharSetUnicode; 187result |= MethodImportAttributes.CharSetAuto; 195result |= MethodImportAttributes.SetLastError; 201result |= MethodImportAttributes.CallingConventionWinApi; 205result |= MethodImportAttributes.CallingConventionCDecl; 209result |= MethodImportAttributes.CallingConventionStdCall; 213result |= MethodImportAttributes.CallingConventionThisCall; 217result |= MethodImportAttributes.CallingConventionFastCall; 225result |= MethodImportAttributes.ThrowOnUnmappableCharEnable; 229result |= MethodImportAttributes.ThrowOnUnmappableCharDisable; 237result |= MethodImportAttributes.BestFitMappingEnable; 241result |= MethodImportAttributes.BestFitMappingDisable;
Microsoft.CodeAnalysis.VisualBasic (9)
Symbols\Source\SourceMethodSymbol.vb (9)
286Private Shared Function GetPInvokeAttributes(syntax As DeclareStatementSyntax) As MethodImportAttributes 287Dim result As MethodImportAttributes 290result = MethodImportAttributes.CharSetAnsi Or MethodImportAttributes.ExactSpelling 293result = MethodImportAttributes.CharSetUnicode Or MethodImportAttributes.ExactSpelling 296result = MethodImportAttributes.CharSetAuto 299Return result Or MethodImportAttributes.CallingConventionWinApi Or MethodImportAttributes.SetLastError
Microsoft.DotNet.ILAssembler (56)
Actions\GrammarActions.MethodHeaders.Actions.cs (30)
178CILParser.AttributeValue<MethodImportAttributes> value) 184internal CILParser.AttributeValue<MethodImportAttributes> 188"nomangle" => new CILParser.AttributeValue<MethodImportAttributes>( 189MethodImportAttributes.ExactSpelling, 192"ansi" => new CILParser.AttributeValue<MethodImportAttributes>( 193MethodImportAttributes.CharSetAnsi, 196"unicode" => new CILParser.AttributeValue<MethodImportAttributes>( 197MethodImportAttributes.CharSetUnicode, 200"autochar" => new CILParser.AttributeValue<MethodImportAttributes>( 201MethodImportAttributes.CharSetAuto, 204"lasterr" => new CILParser.AttributeValue<MethodImportAttributes>( 205MethodImportAttributes.SetLastError, 208"winapi" => new CILParser.AttributeValue<MethodImportAttributes>( 209MethodImportAttributes.CallingConventionWinApi, 212"cdecl" => new CILParser.AttributeValue<MethodImportAttributes>( 213MethodImportAttributes.CallingConventionCDecl, 216"stdcall" => new CILParser.AttributeValue<MethodImportAttributes>( 217MethodImportAttributes.CallingConventionStdCall, 220"thiscall" => new CILParser.AttributeValue<MethodImportAttributes>( 221MethodImportAttributes.CallingConventionThisCall, 224"fastcall" => new CILParser.AttributeValue<MethodImportAttributes>( 225MethodImportAttributes.CallingConventionFastCall, 231internal CILParser.AttributeValue<MethodImportAttributes> 235? MethodImportAttributes.BestFitMappingEnable 236: MethodImportAttributes.BestFitMappingDisable, 240internal CILParser.AttributeValue<MethodImportAttributes> 244? MethodImportAttributes.ThrowOnUnmappableCharEnable 245: MethodImportAttributes.ThrowOnUnmappableCharDisable, 249internal CILParser.AttributeValue<MethodImportAttributes> 252(MethodImportAttributes)ParseInt32(token),
Actions\GrammarActions.MethodHeaders.cs (1)
154(EntityRegistry.ModuleReferenceEntity Module, string? EntryPoint, MethodImportAttributes Attributes)?
CILParser.SemanticValues.Declarations.cs (2)
21MethodImportAttributes Attributes); 169internal MethodImportAttributes Attributes { get; set; }
EntityRegistry.cs (1)
2073public (ModuleReferenceEntity ModuleName, string? EntryPointName, MethodImportAttributes Attributes)? MethodImportInformation { get; set; }
gen\CILParser.cs (2)
12519 public CILParser.AttributeValue<System.Reflection.MethodImportAttributes> Value; 12542 _localctx.Value = CILParser.AttributeValue<System.Reflection.MethodImportAttributes>.Empty;
PseudoCustomAttributes.Application.cs (20)
276MethodImportAttributes flags = MethodImportAttributes.None; 280MethodImportAttributes? callingConventionFlags = (CallingConvention)GetInt32(callingConventionArgument.Value) switch 282CallingConvention.Winapi => MethodImportAttributes.CallingConventionWinApi, 283CallingConvention.Cdecl => MethodImportAttributes.CallingConventionCDecl, 284CallingConvention.StdCall => MethodImportAttributes.CallingConventionStdCall, 285CallingConvention.ThisCall => MethodImportAttributes.CallingConventionThisCall, 286CallingConvention.FastCall => MethodImportAttributes.CallingConventionFastCall, 298flags |= MethodImportAttributes.CallingConventionWinApi; 303MethodImportAttributes? charSetFlags = (CharSet)GetInt32(charSetArgument.Value) switch 305CharSet.None => MethodImportAttributes.None, 306CharSet.Ansi => MethodImportAttributes.CharSetAnsi, 307CharSet.Unicode => MethodImportAttributes.CharSetUnicode, 308CharSet.Auto => MethodImportAttributes.CharSetAuto, 322flags |= MethodImportAttributes.ExactSpelling; 328flags |= MethodImportAttributes.SetLastError; 334? MethodImportAttributes.BestFitMappingEnable 335: MethodImportAttributes.BestFitMappingDisable; 341? MethodImportAttributes.ThrowOnUnmappableCharEnable 342: MethodImportAttributes.ThrowOnUnmappableCharDisable;
System.Reflection.Emit (24)
System\Reflection\Emit\ModuleBuilderImpl.cs (1)
955MethodImportAttributes attributes, ModuleReferenceHandle moduleHandle) =>
System\Reflection\Emit\PseudoCustomAttributesData.cs (23)
14private readonly MethodImportAttributes _flags; 16internal DllImportData(string moduleName, string? entryPoint, MethodImportAttributes flags) 27public MethodImportAttributes Flags => _flags; 37MethodImportAttributes importAttributes = MethodImportAttributes.None; 61importAttributes |= MethodImportAttributes.ExactSpelling; 67importAttributes |= MethodImportAttributes.SetLastError; 73importAttributes |= MethodImportAttributes.BestFitMappingEnable; 77importAttributes |= MethodImportAttributes.BestFitMappingDisable; 83importAttributes |= MethodImportAttributes.ThrowOnUnmappableCharEnable; 87importAttributes |= MethodImportAttributes.ThrowOnUnmappableCharDisable; 103MethodImportAttributes importAttributes = MatchNativeCallingConvention(nativeCallConv); 109private static MethodImportAttributes MatchNativeCharSet(CharSet nativeCharSet) => 112CharSet.Ansi => MethodImportAttributes.CharSetAnsi, 113CharSet.Auto => MethodImportAttributes.CharSetAuto, 114CharSet.Unicode => MethodImportAttributes.CharSetUnicode, 115_ => MethodImportAttributes.CharSetAuto 118private static MethodImportAttributes MatchNativeCallingConvention(CallingConvention nativeCallConv) => 121CallingConvention.Cdecl => MethodImportAttributes.CallingConventionCDecl, 122CallingConvention.FastCall => MethodImportAttributes.CallingConventionFastCall, 123CallingConvention.StdCall => MethodImportAttributes.CallingConventionStdCall, 124CallingConvention.ThisCall => MethodImportAttributes.CallingConventionThisCall, 125_ => MethodImportAttributes.CallingConventionWinApi // Roslyn defaults with this
System.Reflection.Metadata (6)
System\Reflection\Metadata\Ecma335\MetadataBuilder.Tables.cs (1)
1023MethodImportAttributes attributes,
System\Reflection\Metadata\Internal\Tables.cs (2)
1756var pInvokeMapFlags = (MethodImportAttributes)Block.PeekUInt16(rowOffset + _FlagsOffset);
System\Reflection\Metadata\TypeSystem\MethodImport.cs (3)
8private readonly MethodImportAttributes _attributes; 12internal MethodImport(MethodImportAttributes attributes, StringHandle name, ModuleReferenceHandle module) 19public MethodImportAttributes Attributes { get { return _attributes; } }
System.Reflection.MetadataLoadContext (17)
System\Reflection\TypeLoading\MethodBase\Ecma\EcmaMethodDecoder.cs (17)
123MethodImportAttributes a = mi.Attributes; 124CharSet charSet = (a & MethodImportAttributes.CharSetMask) switch 126MethodImportAttributes.CharSetAnsi => CharSet.Ansi, 127MethodImportAttributes.CharSetAuto => CharSet.Auto, 128MethodImportAttributes.CharSetUnicode => CharSet.Unicode, 131CallingConvention callConv = (a & MethodImportAttributes.CallingConventionMask) switch 133MethodImportAttributes.CallingConventionCDecl => CallingConvention.Cdecl, 134MethodImportAttributes.CallingConventionFastCall => CallingConvention.FastCall, 135MethodImportAttributes.CallingConventionStdCall => CallingConvention.StdCall, 136MethodImportAttributes.CallingConventionThisCall => CallingConvention.ThisCall, 137MethodImportAttributes.CallingConventionWinApi => CallingConvention.Winapi, 143ExactSpelling = (a & MethodImportAttributes.ExactSpelling) != 0, 147SetLastError = (a & MethodImportAttributes.SetLastError) != 0, 148BestFitMapping = (a & MethodImportAttributes.BestFitMappingMask) == MethodImportAttributes.BestFitMappingEnable, 149ThrowOnUnmappableChar = (a & MethodImportAttributes.ThrowOnUnmappableCharMask) == MethodImportAttributes.ThrowOnUnmappableCharEnable,