/// <summary> /// Reads custom debug info /// </summary> /// <param name="method">Method</param> /// <param name="body">The method's body. Needs to be provided by the caller since we're called from /// PDB-init code when the Body property hasn't been initialized yet</param> /// <param name="result">Place all custom debug info in this list</param> /// <param name="stream">Custom debug info from the PDB file</param> public static void Read(MethodDef method, CilBody body, IList <PdbCustomDebugInfo> result, IBinaryReader stream) { try { using (var reader = new PdbCustomDebugInfoReader(method, body, result, stream)) reader.Read(); } catch (ArgumentException) { } catch (OutOfMemoryException) { } catch (IOException) { } }
internal void InitializeMethodBody(ModuleDefMD module, MethodDef ownerMethod, CilBody body, uint methodRid) { Debug.Assert((module == null) == (ownerMethod == null)); if (reader == null || body == null) { return; } var token = new SymbolToken((int)(0x06000000 + methodRid)); ISymbolMethod method; #if THREAD_SAFE theLock.EnterWriteLock(); try { #endif method = reader.GetMethod(token); if (method != null) { var pdbMethod = new PdbMethod(); pdbMethod.Scope = CreateScope(module, ownerMethod == null ? new GenericParamContext() : GenericParamContext.Create(ownerMethod), body, method.RootScope); AddSequencePoints(body, method); var method2 = method as ISymbolMethod2; Debug.Assert(method2 != null); if (module != null && method2 != null && method2.IsAsyncMethod) { pdbMethod.AsyncMethod = CreateAsyncMethod(module, ownerMethod, body, method2); } if (ownerMethod != null) { // Read the custom debug info last so eg. local names have been initialized var cdiData = reader.GetSymAttribute(token, "MD2"); if (cdiData != null && cdiData.Length != 0) { PdbCustomDebugInfoReader.Read(ownerMethod, body, pdbMethod.CustomDebugInfos, cdiData); } } body.PdbMethod = pdbMethod; } #if THREAD_SAFE } finally { theLock.ExitWriteLock(); } #endif }