+ public void Shape(int rank, ImmutableArray<int> sizes, ImmutableArray<int> lowerBounds);
+ }
+ public struct BlobEncoder {
+ public BlobEncoder(BlobBuilder builder);
+ public BlobBuilder Builder { get; }
+ public void CustomAttributeSignature(Action<FixedArgumentsEncoder> fixedArguments, Action<CustomAttributeNamedArgumentsEncoder> namedArguments);
+ public void CustomAttributeSignature(out FixedArgumentsEncoder fixedArguments, out CustomAttributeNamedArgumentsEncoder namedArguments);
+ public SignatureTypeEncoder FieldSignature();
+ public LocalVariablesEncoder LocalVariableSignature(int variableCount);
+ public MethodSignatureEncoder MethodSignature(SignatureCallingConvention convention=(SignatureCallingConvention)(0), int genericParameterCount=0, bool isInstanceMethod=false);
+ public GenericTypeArgumentsEncoder MethodSpecificationSignature(int genericArgumentCount);
+ public NamedArgumentsEncoder PermissionSetArguments(int argumentCount);
+ public PermissionSetEncoder PermissionSetBlob(int attributeCount);
+ public MethodSignatureEncoder PropertySignature(bool isInstanceProperty=false);
+ public SignatureTypeEncoder TypeSpecificationSignature();
+ }
+ public static class CodedIndex {
+ public static int CustomAttributeType(EntityHandle handle);
+ public static int HasConstant(EntityHandle handle);
+ public static int HasCustomAttribute(EntityHandle handle);
+ public static int HasCustomDebugInformation(EntityHandle handle);
+ public static int HasDeclSecurity(EntityHandle handle);
+ public static int HasFieldMarshal(EntityHandle handle);
+ public static int HasSemantics(EntityHandle handle);
+ public static int Implementation(EntityHandle handle);
+ public static int MemberForwarded(EntityHandle handle);
+ public static int MemberRefParent(EntityHandle handle);
+ public static int MethodDefOrRef(EntityHandle handle);
+ public static int ResolutionScope(EntityHandle handle);
+ public static int TypeDefOrRef(EntityHandle handle);
+ public static int TypeDefOrRefOrSpec(EntityHandle handle);
+ public static int TypeOrMethodDef(EntityHandle handle);
+ public CustomAttributeArrayTypeEncoder(BlobBuilder builder);
+ public BlobBuilder Builder { get; }
+ public CustomAttributeElementTypeEncoder ElementType();
+ public void ObjectArray();
+ }
+ public struct CustomAttributeElementTypeEncoder {
+ public CustomAttributeElementTypeEncoder(BlobBuilder builder);
+ public BlobBuilder Builder { get; }
+ public void Boolean();
+ public void Byte();
+ public void Char();
+ public void Double();
+ public void Enum(string enumTypeName);
+ public void Int16();
+ public void Int32();
+ public void Int64();
+ public void PrimitiveType(PrimitiveSerializationTypeCode type);
+ public void SByte();
+ public void Single();
+ public void String();
+ public void SystemType();
+ public void UInt16();
+ public void UInt32();
+ public void UInt64();
+ }
+ public struct CustomAttributeNamedArgumentsEncoder {
+ public CustomAttributeNamedArgumentsEncoder(BlobBuilder builder);
+ public BlobBuilder Builder { get; }
+ public NamedArgumentsEncoder Count(int count);
+ }
+ public struct CustomModifiersEncoder {
+ public CustomModifiersEncoder(BlobBuilder builder);
+ public BlobBuilder Builder { get; }
+ public CustomModifiersEncoder AddModifier(EntityHandle type, bool isOptional);
+ }
+ public struct ExceptionRegionEncoder {
+ public BlobBuilder Builder { get; }
+ public bool HasSmallFormat { get; }
+ public ExceptionRegionEncoder Add(ExceptionRegionKind kind, int tryOffset, int tryLength, int handlerOffset, int handlerLength, EntityHandle catchType=null, int filterOffset=0);
+ public ExceptionRegionEncoder AddCatch(int tryOffset, int tryLength, int handlerOffset, int handlerLength, EntityHandle catchType);
+ public ExceptionRegionEncoder AddFault(int tryOffset, int tryLength, int handlerOffset, int handlerLength);
+ public ExceptionRegionEncoder AddFilter(int tryOffset, int tryLength, int handlerOffset, int handlerLength, int filterOffset);
+ public ExceptionRegionEncoder AddFinally(int tryOffset, int tryLength, int handlerOffset, int handlerLength);
+ public static bool IsSmallExceptionRegion(int startOffset, int length);
+ public static bool IsSmallRegionCount(int exceptionRegionCount);
+ }
+ public struct FixedArgumentsEncoder {
+ public FixedArgumentsEncoder(BlobBuilder builder);
+ public BlobBuilder Builder { get; }
+ public LiteralEncoder AddArgument();
+ }
+ public enum FunctionPointerAttributes {
+ HasExplicitThis = 96,
+ HasThis = 32,
+ None = 0,
+ }
+ public struct GenericTypeArgumentsEncoder {
+ public GenericTypeArgumentsEncoder(BlobBuilder builder);
+ public BlobBuilder Builder { get; }
+ public SignatureTypeEncoder AddArgument();
+ }
+ public struct InstructionEncoder {
+ public InstructionEncoder(BlobBuilder codeBuilder, ControlFlowBuilder controlFlowBuilder=null);
+ public BlobBuilder CodeBuilder { get; }
+ public ControlFlowBuilder ControlFlowBuilder { get; }
+ public int Offset { get; }
+ public void Branch(ILOpCode code, LabelHandle label);
+ public void Call(EntityHandle methodHandle);
+ public void Call(MemberReferenceHandle methodHandle);
+ public void Call(MethodDefinitionHandle methodHandle);
+ public void Call(MethodSpecificationHandle methodHandle);
+ public void CallIndirect(StandaloneSignatureHandle signature);
+ public LabelHandle DefineLabel();
+ public void LoadArgument(int argumentIndex);
+ public void LoadArgumentAddress(int argumentIndex);
+ public void LoadConstantI4(int value);
+ public void LoadConstantI8(long value);
+ public void LoadConstantR4(float value);
+ public void LoadConstantR8(double value);
+ public void LoadLocal(int slotIndex);
+ public void LoadLocalAddress(int slotIndex);
+ public void LoadString(UserStringHandle handle);
+ public void MarkLabel(LabelHandle label);
+ public void OpCode(ILOpCode code);
+ public void StoreArgument(int argumentIndex);
+ public void StoreLocal(int slotIndex);
+ public void Token(int token);
+ public void Token(EntityHandle handle);
+ }
+ public struct LabelHandle : IEquatable<LabelHandle> {
+ public int Id { get; }
+ public bool IsNil { get; }
+ public override bool Equals(object obj);
+ public bool Equals(LabelHandle other);
+ public override int GetHashCode();
+ public static bool operator ==(LabelHandle left, LabelHandle right);
+ public static bool operator !=(LabelHandle left, LabelHandle right);
+ }
+ public struct LiteralEncoder {
+ public LiteralEncoder(BlobBuilder builder);
+ public BlobBuilder Builder { get; }
+ public ScalarEncoder Scalar();
+ public void TaggedScalar(Action<CustomAttributeElementTypeEncoder> type, Action<ScalarEncoder> scalar);
+ public void TaggedScalar(out CustomAttributeElementTypeEncoder type, out ScalarEncoder scalar);
+ public void TaggedVector(Action<CustomAttributeArrayTypeEncoder> arrayType, Action<VectorEncoder> vector);
+ public void TaggedVector(out CustomAttributeArrayTypeEncoder arrayType, out VectorEncoder vector);
+ public VectorEncoder Vector();
+ }
+ public struct LiteralsEncoder {
+ public LiteralsEncoder(BlobBuilder builder);
+ public BlobBuilder Builder { get; }
+ public LiteralEncoder AddLiteral();
+ }
+ public struct LocalVariablesEncoder {
+ public LocalVariablesEncoder(BlobBuilder builder);
+ public BlobBuilder Builder { get; }
+ public LocalVariableTypeEncoder AddVariable();
+ }
+ public struct LocalVariableTypeEncoder {
+ public LocalVariableTypeEncoder(BlobBuilder builder);
+ public BlobBuilder Builder { get; }
+ public CustomModifiersEncoder CustomModifiers();
+ public SignatureTypeEncoder Type(bool isByRef=false, bool isPinned=false);
+ public void TypedReference();
+ }
+ public sealed class MetadataBuilder {
+ public MetadataBuilder(int userStringHeapStartOffset=0, int stringHeapStartOffset=0, int blobHeapStartOffset=0, int guidHeapStartOffset=0);
+ public AssemblyDefinitionHandle AddAssembly(StringHandle name, Version version, StringHandle culture, BlobHandle publicKey, AssemblyFlags flags, AssemblyHashAlgorithm hashAlgorithm);
+ public AssemblyFileHandle AddAssemblyFile(StringHandle name, BlobHandle hashValue, bool containsMetadata);
+ public AssemblyReferenceHandle AddAssemblyReference(StringHandle name, Version version, StringHandle culture, BlobHandle publicKeyOrToken, AssemblyFlags flags, BlobHandle hashValue);
+ public ConstantHandle AddConstant(EntityHandle parent, object value);
+ public CustomAttributeHandle AddCustomAttribute(EntityHandle parent, EntityHandle constructor, BlobHandle value);
+ public CustomDebugInformationHandle AddCustomDebugInformation(EntityHandle parent, GuidHandle kind, BlobHandle value);
+ public DeclarativeSecurityAttributeHandle AddDeclarativeSecurityAttribute(EntityHandle parent, DeclarativeSecurityAction action, BlobHandle permissionSet);
+ public void AddEncLogEntry(EntityHandle entity, EditAndContinueOperation code);
+ public void AddEncMapEntry(EntityHandle entity);
+ public EventDefinitionHandle AddEvent(EventAttributes attributes, StringHandle name, EntityHandle type);
+ public void AddEventMap(TypeDefinitionHandle declaringType, EventDefinitionHandle eventList);
+ public ExportedTypeHandle AddExportedType(TypeAttributes attributes, StringHandle @namespace, StringHandle name, EntityHandle implementation, int typeDefinitionId);
+ public FieldDefinitionHandle AddFieldDefinition(FieldAttributes attributes, StringHandle name, BlobHandle signature);
+ public void AddFieldLayout(FieldDefinitionHandle field, int offset);
+ public void AddFieldRelativeVirtualAddress(FieldDefinitionHandle field, int offset);
+ public GenericParameterHandle AddGenericParameter(EntityHandle parent, GenericParameterAttributes attributes, StringHandle name, int index);
+ public GenericParameterConstraintHandle AddGenericParameterConstraint(GenericParameterHandle genericParameter, EntityHandle constraint);
+ public ImportScopeHandle AddImportScope(ImportScopeHandle parentScope, BlobHandle imports);
+ public InterfaceImplementationHandle AddInterfaceImplementation(TypeDefinitionHandle type, EntityHandle implementedInterface);
+ public LocalConstantHandle AddLocalConstant(StringHandle name, BlobHandle signature);
+ public LocalScopeHandle AddLocalScope(MethodDefinitionHandle method, ImportScopeHandle importScope, LocalVariableHandle variableList, LocalConstantHandle constantList, int startOffset, int length);
+ public LocalVariableHandle AddLocalVariable(LocalVariableAttributes attributes, int index, StringHandle name);
+ public MetadataRootBuilder(MetadataBuilder tablesAndHeaps, string metadataVersion=null, bool suppressValidation=false);
+ public string MetadataVersion { get; }
+ public MetadataSizes Sizes { get; }
+ public bool SuppressValidation { get; }
+ public void Serialize(BlobBuilder builder, int methodBodyStreamRva, int mappedFieldDataStreamRva);
+ }
+ public sealed class MetadataSizes {
+ public ImmutableArray<int> ExternalRowCounts { get; }
+ public ImmutableArray<int> HeapSizes { get; }
+ public ImmutableArray<int> RowCounts { get; }
+ public int GetAlignedHeapSize(HeapIndex index);
+ }
public static class MetadataTokens {
+ public static int GetHeapOffset(BlobHandle handle);
+ public static int GetHeapOffset(GuidHandle handle);
+ public static int GetHeapOffset(StringHandle handle);
+ public static int GetHeapOffset(UserStringHandle handle);
}
+ public enum MethodBodyAttributes {
+ InitLocals = 1,
+ None = 0,
+ }
+ public struct MethodBodyStreamEncoder {
+ public MethodBodyStreamEncoder(BlobBuilder builder);
+ public BlobBuilder Builder { get; }
+ public MethodBodyStreamEncoder.MethodBody AddMethodBody(int codeSize, int maxStack=8, int exceptionRegionCount=0, bool hasSmallExceptionRegions=true, StandaloneSignatureHandle localVariablesSignature=null, MethodBodyAttributes attributes=(MethodBodyAttributes)(1));
+ public int AddMethodBody(InstructionEncoder instructionEncoder, int maxStack=8, StandaloneSignatureHandle localVariablesSignature=null, MethodBodyAttributes attributes=(MethodBodyAttributes)(1));
+ public struct MethodBody {
+ public ExceptionRegionEncoder ExceptionRegions { get; }
+ public Blob Instructions { get; }
+ public int Offset { get; }
+ }
+ }
+ public struct MethodSignatureEncoder {
+ public MethodSignatureEncoder(BlobBuilder builder, bool hasVarArgs);
+ public BlobBuilder Builder { get; }
+ public bool HasVarArgs { get; }
+ public void Parameters(int parameterCount, Action<ReturnTypeEncoder> returnType, Action<ParametersEncoder> parameters);
+ public void Parameters(int parameterCount, out ReturnTypeEncoder returnType, out ParametersEncoder parameters);
+ }
+ public struct NamedArgumentsEncoder {
+ public NamedArgumentsEncoder(BlobBuilder builder);
+ public Func<IEnumerable<Blob>, BlobContentId> IdProvider { get; }
+ public string MetadataVersion { get; }
+ public BlobContentId Serialize(BlobBuilder builder);
+ }
+ public struct ReturnTypeEncoder {
+ public ReturnTypeEncoder(BlobBuilder builder);
+ public BlobBuilder Builder { get; }
+ public CustomModifiersEncoder CustomModifiers();
+ public SignatureTypeEncoder Type(bool isByRef=false);
+ public void TypedReference();
+ public void Void();
+ }
+ public struct ScalarEncoder {
+ public ScalarEncoder(BlobBuilder builder);
+ public BlobBuilder Builder { get; }
+ public void Constant(object value);
+ public void NullArray();
+ public void SystemType(string serializedTypeName);
+ }
+ public struct SignatureDecoder<TType> {
+ public SignatureDecoder(ISignatureTypeProvider<TType> provider, MetadataReader metadataReader=null);
+ public TType DecodeFieldSignature(ref BlobReader blobReader);
+ public ImmutableArray<TType> DecodeLocalSignature(ref BlobReader blobReader);
+ public MethodSignature<TType> DecodeMethodSignature(ref BlobReader blobReader);
+ public ImmutableArray<TType> DecodeMethodSpecificationSignature(ref BlobReader blobReader);
+ public TType DecodeType(ref BlobReader blobReader, bool allowTypeSpecifications=false);
+ }
+ public struct SignatureTypeEncoder {
+ public SignatureTypeEncoder(BlobBuilder builder);
+ public BlobBuilder Builder { get; }
+ public void Array(Action<SignatureTypeEncoder> elementType, Action<ArrayShapeEncoder> arrayShape);
+ public void Array(out SignatureTypeEncoder elementType, out ArrayShapeEncoder arrayShape);
+ public void Boolean();
+ public void Byte();
+ public void Char();
+ public CustomModifiersEncoder CustomModifiers();
+ public void Double();
+ public MethodSignatureEncoder FunctionPointer(SignatureCallingConvention convention=(SignatureCallingConvention)(0), FunctionPointerAttributes attributes=(FunctionPointerAttributes)(0), int genericParameterCount=0);
+ public GenericTypeArgumentsEncoder GenericInstantiation(EntityHandle genericType, int genericArgumentCount, bool isValueType);
+ public void GenericMethodTypeParameter(int parameterIndex);
+ public void GenericTypeParameter(int parameterIndex);
+ public void Int16();
+ public void Int32();
+ public void Int64();
+ public void IntPtr();
+ public void Object();
+ public SignatureTypeEncoder Pointer();
+ public void PrimitiveType(PrimitiveTypeCode type);
+ public void SByte();
+ public void Single();
+ public void String();
+ public SignatureTypeEncoder SZArray();
+ public void Type(EntityHandle type, bool isValueType);