Beispiel #1
0
        private Object ResolveMethodSpecification(MethodSpecificationHandle handle)
        {
            MethodSpecification methodSpecification = _metadataReader.GetMethodSpecification(handle);

            object resolvedMethod = GetObject(methodSpecification.Method, NotFoundBehavior.ReturnResolutionFailure);

            if (resolvedMethod is ResolutionFailure)
            {
                return(resolvedMethod);
            }

            MethodDesc methodDef = resolvedMethod as MethodDesc;

            if (methodDef == null)
            {
                ThrowHelper.ThrowBadImageFormatException($"method expected for handle {handle.ToString()}");
            }

            BlobReader          signatureReader = _metadataReader.GetBlobReader(methodSpecification.Signature);
            EcmaSignatureParser parser          = new EcmaSignatureParser(this, signatureReader, NotFoundBehavior.ReturnResolutionFailure);

            TypeDesc[] instantiation = parser.ParseMethodSpecSignature();

            if (instantiation == null)
            {
                return(parser.ResolutionFailure);
            }

            return(Context.GetInstantiatedMethod(methodDef, new Instantiation(instantiation)));
        }