private static PerDocumentSequencePoints GenerateSequencePointInfoImpl(IRunExecutorHost host, RunStartParams rsp) { var timeFilter = rsp.StartTime; var buildOutputRoot = rsp.Solution.BuildRoot.Item; Logger.LogInfo( "Generating sequence point info: Time filter - {0}, Build output root - {1}.", timeFilter.ToLocalTime(), buildOutputRoot); var perDocSP = new PerDocumentSequencePoints(); Engine.Engine.FindAndExecuteForEachAssembly( host, buildOutputRoot, timeFilter, (string assemblyPath) => { Logger.LogInfo("Generating sequence point info for {0}.", assemblyPath); var assembly = AssemblyDefinition.ReadAssembly(assemblyPath, new ReaderParameters { ReadSymbols = true }); VisitAllTypes( assembly.Modules, (m, t) => { FindSequencePointForType(rsp, perDocSP, m, t); }); }); return(perDocSP); }
private static PerDocumentSequencePoints GenerateSequencePointInfoImpl2(FilePath assemblyPath, FilePath projectPath, FilePath projectSnapshotPath) { var perDocSP = new PerDocumentSequencePoints(); Logger.LogInfo("Generating sequence point info for {0}.", assemblyPath); var assembly = AssemblyDefinition.ReadAssembly(assemblyPath.Item, new ReaderParameters { ReadSymbols = true }); VisitAllTypes( assembly.Modules, (m, t) => { FindSequencePointForType2(projectPath, projectSnapshotPath, perDocSP, m, t); }); return(perDocSP); }
private static void FindSequencePointForType(RunStartParams rsp, PerDocumentSequencePoints perDocSP, ModuleDefinition module, TypeDefinition type) { foreach (MethodDefinition meth in type.Methods) { if (IsMethodSkipped(meth)) { continue; } var sps = from i in meth.Body.Instructions where i.SequencePoint != null where i.SequencePoint.StartLine != 0xfeefee select new { module, meth, i.SequencePoint }; int id = 0; foreach (var sp in sps) { var fp = PathBuilder.rebaseCodeFilePath(rsp.Solution.Path, rsp.Solution.SnapshotPath, FilePath.NewFilePath(sp.SequencePoint.Document.Url)); var seqPts = perDocSP.GetOrAdd(fp, _ => new ConcurrentBag <R4nd0mApps.TddStud10.Common.Domain.SequencePoint>()); seqPts.Add(new R4nd0mApps.TddStud10.Common.Domain.SequencePoint { id = new SequencePointId { methodId = new MethodId(AssemblyId.NewAssemblyId(sp.module.Mvid), MdTokenRid.NewMdTokenRid(sp.meth.MetadataToken.RID)), uid = id++ }, document = fp, startLine = DocumentCoordinate.NewDocumentCoordinate(sp.SequencePoint.StartLine), startColumn = DocumentCoordinate.NewDocumentCoordinate(sp.SequencePoint.StartColumn), endLine = DocumentCoordinate.NewDocumentCoordinate(sp.SequencePoint.EndLine), endColumn = DocumentCoordinate.NewDocumentCoordinate(sp.SequencePoint.EndColumn), }); } } }