public static TypeDefinition Resolve(TypeReference tr, IEnumerable<AssemblyDefinition> assemblyList, ITextInfo info) { if (tr == null) return null; if (tr is TypeDefinition) return (TypeDefinition)tr; try { SetupResolveFirst(assemblyList); if (tr.Name == null || tr.Name.Length == 0) { throw new ApplicationException( String.Format("Could not resolve: type reference 0x{0:x08}, type name is empty.", tr.MetadataToken.ToUInt32())); } return tr.Resolve(); } catch(Exception ex) { if (info != null && !info.TextInfo.Contains(ex.Message)) info.AppendTextInfoLine(ex.Message); return null; } finally { RemoveResolveFirst(); } }
public static MethodDefinition Resolve(MethodReference mr, IEnumerable<AssemblyDefinition> assemblyList, ITextInfo info) { if (mr == null) return null; if (mr is MethodDefinition) return (MethodDefinition)mr; try { SetupResolveFirst(assemblyList); return mr.Resolve(); } catch(Exception ex) { if (info != null && !info.TextInfo.Contains(ex.Message)) info.AppendTextInfoLine(ex.Message); return null; } finally { RemoveResolveFirst(); } }