1 write to Context
Microsoft.CodeAnalysis (1)
PEWriter\MetadataWriter.cs (1)
116this.Context = context;
140 references to Context
Microsoft.CodeAnalysis (140)
Emit\EditAndContinue\DeltaMetadataWriter.cs (12)
282if (!_methodDefs.IsAddedNotChanged(def) && def.GetBody(Context)?.SequencePoints.Length > 0) 492module.OnCreatedIndices(this.Context.Diagnostics); 633foreach (var eventDef in typeDef.GetEvents(this.Context)) 644foreach (var fieldDef in typeDef.GetFields(this.Context)) 650foreach (var methodDef in typeDef.GetMethods(this.Context)) 668foreach (var propertyDef in typeDef.GetProperties(this.Context)) 682foreach (var methodImpl in typeDef.GetExplicitImplementationOverrides(Context)) 684var methodDef = (IMethodDefinition?)methodImpl.ImplementingMethod.AsDefinition(this.Context); 844Context.Diagnostics.Add(messageProvider.CreateDiagnostic( 917translatedType = Context.Module.EncTranslateType(typeSymbol, Context.Diagnostics); 1834Visit(module.GetTopLevelTypeDefinitions(metadataWriter.Context));
NativePdbWriter\PdbWriter.cs (4)
64private EmitContext Context => _metadataWriter.Context; 382typeReference = nestedType.GetContainingType(_metadataWriter.Context); 421var allAliases = _metadataWriter.Context.Module.GetAssemblyReferenceAliases(_metadataWriter.Context);
NativePdbWriter\SymWriterMetadataProvider.cs (4)
51if ((namespaceTypeDef = t.AsNamespaceTypeDefinition(_writer.Context)) != null) 65attributes = _writer.GetTypeAttributes(t.GetResolvedType(_writer.Context)); 74declaringTypeToken = MetadataTokens.GetToken(_writer.GetTypeHandle(m.GetContainingType(_writer.Context))); 87enclosingTypeToken = MetadataTokens.GetToken(_writer.GetTypeHandle(nt.GetContainingType(_writer.Context)));
PEWriter\FullMetadataWriter.cs (5)
382foreach (MethodImplementation methodImplementation in typeDef.GetExplicitImplementationOverrides(Context)) 387foreach (IEventDefinition eventDef in typeDef.GetEvents(Context)) 393foreach (IFieldDefinition fieldDef in typeDef.GetFields(Context)) 399foreach (IMethodDefinition methodDef in typeDef.GetMethods(Context)) 405foreach (IPropertyDefinition propertyDef in typeDef.GetProperties(Context))
PEWriter\MemberRefComparer.cs (2)
28if (x.GetContainingType(_metadataWriter.Context) != y.GetContainingType(_metadataWriter.Context))
PEWriter\MetadataWriter.cs (104)
500foreach (INamespaceTypeDefinition typeDef in module.GetTopLevelTypeDefinitions(Context)) 524foreach (var nestedType in typeDef.GetNestedTypes(Context)) 537INestedTypeDefinition nestedTypeDef = typeDef.AsNestedTypeDefinition(Context); 554INestedTypeDefinition nestedTypeDef = typeDef.AsNestedTypeDefinition(Context); 590if (methodDef.ParameterCount == 0 && !(methodDef.ReturnValueIsMarshalledExplicitly || IteratorHelper.EnumerableIsNotEmpty(methodDef.GetReturnValueAttributes(Context)))) 603if (methodDef.ReturnValueIsMarshalledExplicitly || IteratorHelper.EnumerableIsNotEmpty(methodDef.GetReturnValueAttributes(Context))) 617IteratorHelper.EnumerableIsNotEmpty(parDef.GetAttributes(Context))) 670foreach (IAssemblyReference assemblyRef in this.module.GetAssemblyReferences(Context)) 680foreach (IFileReference fileRef in module.GetFiles(Context)) 693var containingAssembly = this.module.GetContainingAssembly(Context); 727IUnitReference definingUnit = GetDefiningUnitReference(methodReference.GetContainingType(Context), Context); 730methodDef = methodReference.GetResolvedMethod(Context); 830IUnitReference definingUnit = GetDefiningUnitReference(fieldReference.GetContainingType(Context), Context); 833fieldDef = fieldReference.GetResolvedField(Context); 898IUnitReference uref = namespaceRef.GetUnit(Context); 905aref = mref.GetContainingAssembly(Context); 906return aref == null || ReferenceEquals(aref, this.module.GetContainingAssembly(Context)) 927ITypeDefinition parentTypeDef = memberRef.GetContainingType(Context).AsTypeDefinition(Context); 945if (this.TryGetMethodDefinitionHandle(methodRef.GetResolvedMethod(Context), out methodHandle)) 958var containingType = memberRef.GetContainingType(Context); 967IUnitReference definingUnit = GetDefiningUnitReference(methodReference.GetContainingType(Context), Context); 970methodDef = methodReference.GetResolvedMethod(Context); 1053var encoder = new BlobEncoder(builder).MethodSpecificationSignature(methodInstanceReference.GetGenericMethod(Context).GenericParameterCount); 1055foreach (ITypeReference typeReference in methodInstanceReference.GetGenericArguments(Context)) 1172IUnitReference definingUnit = GetDefiningUnitReference(methodReference.GetContainingType(Context), Context); 1175methodDef = methodReference.GetResolvedMethod(Context); 1305aref = mref.GetContainingAssembly(Context); 1307if (aref != null && aref != module.GetContainingAssembly(Context)) 1357this.Context.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_MetadataNameTooLong, location, name)); 1366this.Context.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_MetadataNameTooLong, location, path)); 1390this.Context.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_MetadataNameTooLong, location, namespaceName + "." + mangledTypeName)); 1400this.Context.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.WRN_PdbUsingNameTooLong, location, usingString)); 1412this.Context.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.WRN_PdbLocalNameTooLong, localDefinition.Location, name)); 1462return GetTypeAttributes(typeDef, Context); 1612GetTypeReferenceHandle(nestedTypeRef.GetContainingType(this.Context)); 1663var typeDefinition = typeReference.AsTypeDefinition(this.Context); 1798if (Context.RebuildData is { } rebuildData) 1876entryPointHandle = entryPoint != null ? (MethodDefinitionHandle)GetMethodHandle((IMethodDefinition)entryPoint.AsDefinition(Context)) : default(MethodDefinitionHandle); 1882debugEntryPointHandle = (MethodDefinitionHandle)GetMethodHandle((IMethodDefinition)debugEntryPoint.AsDefinition(Context)); 2044this.module.GetSourceAssemblyAttributes(Context.IsRefAssembly), 2079resolutionScope: GetResolutionScopeHandle(module.GetCorLibrary(Context)), 2106AddCustomAttributesToTable(parentHandle, parent.GetAttributes(Context)); 2122AddCustomAttributesToTable(parentHandle, parent.GetAttributes(Context)); 2136IMethodReference constructor = customAttribute.Constructor(Context, reportDiagnostics: true); 2214type: GetTypeHandle(eventDef.GetType(Context))); 2225var exportedTypes = module.GetExportedTypes(Context.Diagnostics); 2388var constant = fieldDef.GetCompileTimeValue(Context); 2401var defaultValue = parDef.GetDefaultValue(Context); 2460foreach (var refWithAttributes in genericParameter.GetConstraints(Context)) 2499foreach (var interfaceImpl in typeDef.Interfaces(Context)) 2525foreach (var resource in this.module.GetResources(Context)) 2608method: GetMethodDefinitionOrReferenceHandle(genericMethodInstanceReference.GetGenericMethod(Context)), 2623implAttributes: methodDef.GetImplementationAttributes(Context), 2644foreach (IMethodReference accessorMethod in propertyDef.GetAccessors(Context)) 2663methodDefinition: GetMethodDefinitionHandle(accessorMethod.GetResolvedMethod(Context))); 2670foreach (IMethodReference accessorMethod in eventDef.GetAccessors(Context)) 2693methodDefinition: GetMethodDefinitionHandle(accessorMethod.GetResolvedMethod(Context))); 2773INamespaceTypeDefinition namespaceType = typeDef.AsNamespaceTypeDefinition(Context); 2775var moduleBuilder = Context.Module; 2779ITypeReference baseType = typeDef.GetBaseClass(Context); 2795INestedTypeDefinition nestedTypeDef = typeDef.AsNestedTypeDefinition(Context); 2842scopeTypeRef = sneTypeRef.GetUnspecializedVersion(Context).GetContainingType(Context); 2846scopeTypeRef = nestedTypeRef.GetContainingType(Context); 2866resolutionScope = this.GetResolutionScopeHandle(namespaceTypeRef.GetUnit(Context)); 2960body = method.GetBody(Context); 3169this.Context.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_TooManyUserStrings, NoLocation.Singleton)); 3187this.Context.Diagnostics.Add(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_TooManyUserStrings, NoLocation.Singleton)); 3412var type = parameterTypeInformation.GetType(Context); 3435SerializeTypeReference(typeEncoder, fieldReference.GetType(Context)); 3440var argsEncoder = new BlobEncoder(builder).MethodSpecificationSignature(genericMethodInstanceReference.GetGenericMethod(Context).GenericParameterCount); 3441foreach (ITypeReference genericArgument in genericMethodInstanceReference.GetGenericArguments(Context)) 3453Context.Module, 3454Context.Diagnostics, 3455metadataOnly: Context.MetadataOnly, 3456includePrivateMembers: Context.IncludePrivateMembers, 3457rebuildData: Context.RebuildData, 3460return Context; 3465var parameters = customAttribute.Constructor(Context, reportDiagnostics: false).GetParameters(Context); 3466var arguments = customAttribute.GetArguments(Context); 3477SerializeMetadataExpression(in attributeContext, fixedArgsEncoder.AddArgument(), arguments[i], parameters[i].GetType(Context)); 3485foreach (IMetadataNamedArgument namedArgument in customAttribute.GetNamedArguments(Context)) 3538targetElementType = targetArrayType.GetElementType(this.Context); 3611object marshaller = marshallingInformation.GetCustomMarshaller(Context); 3662var elementType = marshallingInformation.GetSafeArrayElementUserDefinedSubtype(Context); 3689writer.WriteSerializedString(typeReference.GetSerializedTypeName(this.Context)); 3744EmitContext context = this.Context; 3773var declaredParameters = signature.GetParameters(Context); 3774var returnType = signature.GetType(Context); 3849typeReference = pointerTypeReference.GetTargetType(Context); 3873typeReference = arrayTypeReference.GetElementType(Context); 3906ITypeReference uninstantiatedTypeReference = typeReference.GetUninstantiatedGenericType(Context); 3912typeReference.GetConsolidatedTypeArguments(consolidatedTypeArguments, this.Context); 4017var elementType = arrayTypeReference.GetElementType(Context); 4119encoder = encoder.AddModifier(GetTypeHandle(modifier.GetModifier(Context)), modifier.IsOptional); 4134nestedType = specializedNestedType.GetUnspecializedVersion(Context); 4138type = nestedType.GetContainingType(Context); 4143type = nestedType.GetContainingType(Context);
PEWriter\MetadataWriter.PortablePdb.cs (5)
158if (Context.Module.CommonCompilation.Options.EnableEditAndContinue && IsFullMetadata) 419foreach (AssemblyReferenceAlias alias in module.GetAssemblyReferenceAliases(Context)) 460foreach (UsedNamespaceOrType import in scope.GetUsedNamespaces(Context)) 879if (this.Context.RebuildData is { } rebuildData) 1020foreach (var (definition, documents) in module.GetTypeToDebugDocumentMap(Context))
PEWriter\MethodSpecComparer.cs (3)
29_metadataWriter.GetMethodDefinitionOrReferenceHandle(x.GetGenericMethod(_metadataWriter.Context)) == _metadataWriter.GetMethodDefinitionOrReferenceHandle(y.GetGenericMethod(_metadataWriter.Context)) && 36_metadataWriter.GetMethodDefinitionOrReferenceHandle(methodInstanceReference.GetGenericMethod(_metadataWriter.Context)).GetHashCode(),
PEWriter\ReferenceIndexer.cs (1)
21: base(metadataWriter.Context)