public void Deconstruct(out TextSpan unmappedSpan, out ActiveStatement statement, out ActiveStatementExceptionRegions exceptionRegions) { unmappedSpan = UnmappedSpan; statement = Statement; exceptionRegions = ExceptionRegions; }
private ActiveStatementsMap CreateActiveStatementsMap(Solution solution, ImmutableArray <ActiveStatementDebugInfo> debugInfos) { var byDocument = PooledDictionary <DocumentId, ArrayBuilder <ActiveStatement> > .GetInstance(); var byInstruction = PooledDictionary <ActiveInstructionId, ActiveStatement> .GetInstance(); bool SupportsEditAndContinue(DocumentId documentId) => solution.GetProject(documentId.ProjectId).LanguageServices.GetService <IEditAndContinueAnalyzer>() != null; foreach (var debugInfo in debugInfos) { var documentName = debugInfo.DocumentNameOpt; if (documentName == null) { // Ignore active statements that do not have a source location. continue; } var documentIds = solution.GetDocumentIdsWithFilePath(documentName); var firstDocumentId = documentIds.FirstOrDefault(SupportsEditAndContinue); if (firstDocumentId == null) { // Ignore active statements that don't belong to the solution or language that supports EnC service. continue; } if (!byDocument.TryGetValue(firstDocumentId, out var primaryDocumentActiveStatements)) { byDocument.Add(firstDocumentId, primaryDocumentActiveStatements = ArrayBuilder <ActiveStatement> .GetInstance()); } var activeStatement = new ActiveStatement( ordinal: byInstruction.Count, primaryDocumentOrdinal: primaryDocumentActiveStatements.Count, documentIds: documentIds, flags: debugInfo.Flags, span: GetUpToDateSpan(debugInfo), instructionId: debugInfo.InstructionId, threadIds: debugInfo.ThreadIds); primaryDocumentActiveStatements.Add(activeStatement); // TODO: associate only those documents that are from a project with the right module id // https://github.com/dotnet/roslyn/issues/24320 for (var i = 1; i < documentIds.Length; i++) { var documentId = documentIds[i]; if (!SupportsEditAndContinue(documentId)) { continue; } if (!byDocument.TryGetValue(documentId, out var linkedDocumentActiveStatements)) { byDocument.Add(documentId, linkedDocumentActiveStatements = ArrayBuilder <ActiveStatement> .GetInstance()); } linkedDocumentActiveStatements.Add(activeStatement); } try { byInstruction.Add(debugInfo.InstructionId, activeStatement); } catch (ArgumentException) { throw new InvalidOperationException($"Multiple active statements with the same instruction id returned by " + $"{_activeStatementProvider.GetType()}.{nameof(IActiveStatementProvider.GetActiveStatementsAsync)}"); } } return(new ActiveStatementsMap(byDocument.ToDictionaryAndFree(), byInstruction.ToDictionaryAndFree())); }
public UnmappedActiveStatement(TextSpan unmappedSpan, ActiveStatement statement, ActiveStatementExceptionRegions exceptionRegions) { UnmappedSpan = unmappedSpan; Statement = statement; ExceptionRegions = exceptionRegions; }