DmdMethodBodyReader(IMethodBodyResolver methodBodyResolver, DmdDataStream reader, IList <DmdType> genericTypeArguments, IList <DmdType> genericMethodArguments) { this.methodBodyResolver = methodBodyResolver ?? throw new ArgumentNullException(nameof(methodBodyResolver)); this.reader = reader ?? throw new ArgumentNullException(nameof(reader)); this.genericTypeArguments = genericTypeArguments ?? Array.Empty <DmdType>(); this.genericMethodArguments = genericMethodArguments ?? Array.Empty <DmdType>(); }
DmdCustomAttributeReader(DmdModule module, DmdDataStream reader, DmdType ctorReflectedType, IList<DmdType> genericTypeArguments, bool ownsReader) { this.module = module; this.reader = reader; this.ctorReflectedType = ctorReflectedType; this.genericTypeArguments = genericTypeArguments; this.ownsReader = ownsReader; recursionCounter = 0; }
public static DmdMethodBody Create(IMethodBodyResolver methodBodyResolver, DmdDataStream reader, IList <DmdType> genericTypeArguments, IList <DmdType> genericMethodArguments) { try { return(new DmdMethodBodyReader(methodBodyResolver, reader, genericTypeArguments, genericMethodArguments).Read()); } catch (IOException) { } catch (OutOfMemoryException) { } return(null); }
public static DmdCustomAttributeData Read(DmdModule module, DmdDataStream stream, DmdConstructorInfo ctor) { using (var reader = new DmdCustomAttributeReader(module, stream, ctor.ReflectedType, GetGenericArguments(ctor.ReflectedType), ownsReader: true)) { try { return reader.Read(ctor); } catch (CABlobParserException) { } catch (ResolveException) { } catch (IOException) { } return null; } }
DmdMarshalBlobReader(DmdModule module, DmdDataStream reader, IList <DmdType> genericTypeArguments) { this.module = module; this.reader = reader; this.genericTypeArguments = genericTypeArguments ?? Array.Empty <DmdType>(); }
public static DmdMarshalType Read(DmdModule module, DmdDataStream reader, IList <DmdType> genericTypeArguments) { using (var marshalReader = new DmdMarshalBlobReader(module, reader, genericTypeArguments)) return(marshalReader.Read()); }
public static DmdCustomAttributeData[] Read(DmdModule module, DmdDataStream signature, SecurityAction action, IList <DmdType> genericTypeArguments) { using (var reader = new DmdDeclSecurityReader(module, signature, genericTypeArguments)) return(reader.Read(action)); }
public static DmdCustomAttributeData[] Read(DmdModule module, DmdDataStream signature, SecurityAction action) => Read(module, signature, action, null);
internal static DmdCustomAttributeNamedArgument[] ReadNamedArguments(DmdModule module, DmdDataStream stream, DmdType ctorReflectedType, int numNamedArgs, IList<DmdType> genericTypeArguments) { using (var reader = new DmdCustomAttributeReader(module, stream, ctorReflectedType, genericTypeArguments, ownsReader: false)) { try { return reader.ReadNamedArguments(numNamedArgs); } catch (CABlobParserException) { } catch (ResolveException) { } catch (IOException) { } return null; } }
DmdDeclSecurityReader(DmdModule module, DmdDataStream reader, IList <DmdType>?genericTypeArguments) { this.reader = reader; this.module = module; this.genericTypeArguments = genericTypeArguments ?? Array.Empty <DmdType>(); }
public static (DmdType fieldType, DmdMethodSignature methodSignature, bool containedGenericParams) ReadMethodSignatureOrFieldType(DmdModule module, DmdDataStream reader, IList <DmdType> genericTypeArguments, IList <DmdType> genericMethodArguments, bool resolve) { try { using (var sigReader = new DmdSignatureReader(module, reader, genericTypeArguments, genericMethodArguments, resolve)) { var flags = (DmdSignatureCallingConvention)reader.ReadByte(); if ((flags & DmdSignatureCallingConvention.Mask) == DmdSignatureCallingConvention.Field) { var fieldType = sigReader.ReadType().type; return(fieldType, null, sigReader.containedGenericParams); } else { sigReader.ReadMethodSignature(flags, out var genericParameterCount, out var returnType, out var parameterTypes, out var varArgsParameterTypes); if ((flags & DmdSignatureCallingConvention.Mask) != DmdSignatureCallingConvention.Property) { var methodSignature = new DmdMethodSignature(flags, genericParameterCount, returnType, parameterTypes, varArgsParameterTypes); return(null, methodSignature, sigReader.containedGenericParams); } } } } catch (IOException) { } catch (OutOfMemoryException) { } return(module.AppDomain.System_Void, null, false); }
public static (DmdMethodSignature methodSignature, bool containedGenericParams) ReadMethodSignature(DmdModule module, DmdDataStream reader, IList <DmdType> genericTypeArguments, IList <DmdType> genericMethodArguments, bool isProperty, bool resolve) { try { using (var sigReader = new DmdSignatureReader(module, reader, genericTypeArguments, genericMethodArguments, resolve)) { sigReader.ReadMethodSignature(out var flags, out var genericParameterCount, out var returnType, out var parameterTypes, out var varArgsParameterTypes); if (((flags & DmdSignatureCallingConvention.Mask) == DmdSignatureCallingConvention.Property) == isProperty) { var methodSignature = new DmdMethodSignature(flags, genericParameterCount, returnType, parameterTypes, varArgsParameterTypes); return(methodSignature, sigReader.containedGenericParams); } } } catch (IOException) { } catch (OutOfMemoryException) { } var dummySig = new DmdMethodSignature(isProperty ? DmdSignatureCallingConvention.Property : DmdSignatureCallingConvention.Default, 0, module.AppDomain.System_Void, null, null); return(dummySig, false); }
public static (DmdType fieldType, bool containedGenericParams) ReadFieldSignature(DmdModule module, DmdDataStream reader, IList <DmdType> genericTypeArguments, bool resolve) { try { using (var sigReader = new DmdSignatureReader(module, reader, genericTypeArguments, null, resolve)) { var fieldType = sigReader.ReadFieldSignature(); return(fieldType, sigReader.containedGenericParams); } } catch (IOException) { } catch (OutOfMemoryException) { } return(module.AppDomain.System_Void, false); }
public static (DmdType[] types, bool containedGenericParams) ReadMethodSpecSignature(DmdModule module, DmdDataStream reader, IList <DmdType> genericTypeArguments, IList <DmdType> genericMethodArguments, bool resolve) { try { using (var sigReader = new DmdSignatureReader(module, reader, genericTypeArguments, genericMethodArguments, resolve)) { var types = sigReader.ReadInstantiation(); return(types, sigReader.containedGenericParams); } } catch (IOException) { } catch (OutOfMemoryException) { } return(Array.Empty <DmdType>(), false); }