public async Task <(SolutionUpdateStatus Summary, ImmutableArray <Deltas> Deltas)> EmitSolutionUpdateAsync( Solution solution, SolutionActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken) { var editSession = _editSession; if (editSession == null) { return(SolutionUpdateStatus.None, ImmutableArray <Deltas> .Empty); } var solutionUpdate = await editSession.EmitSolutionUpdateAsync(solution, activeStatementSpanProvider, cancellationToken).ConfigureAwait(false); if (solutionUpdate.Summary == SolutionUpdateStatus.Ready) { editSession.StorePendingUpdate(solution, solutionUpdate); } // clear emit/apply diagnostics reported previously: _emitDiagnosticsUpdateSource.ClearDiagnostics(); // report emit/apply diagnostics: foreach (var(projectId, diagnostics) in solutionUpdate.Diagnostics) { _emitDiagnosticsUpdateSource.ReportDiagnostics(_workspace, solution, projectId, diagnostics); } // Note that we may return empty deltas if all updates have been deferred. // The debugger will still call commit or discard on the update batch. return(solutionUpdate.Summary, solutionUpdate.Deltas); }
public Task <bool> HasChangesAsync(Solution solution, SolutionActiveStatementSpanProvider solutionActiveStatementSpanProvider, string?sourceFilePath, CancellationToken cancellationToken) { // GetStatusAsync is called outside of edit session when the debugger is determining // whether a source file checksum matches the one in PDB. // The debugger expects no changes in this case. var editSession = _editSession; if (editSession == null) { return(SpecializedTasks.False); } return(editSession.HasChangesAsync(solution, solutionActiveStatementSpanProvider, sourceFilePath, cancellationToken)); }
public async Task <DkmTextSpan?> GetCurrentActiveStatementPositionAsync(Guid moduleId, int methodToken, int methodVersion, int ilOffset, CancellationToken cancellationToken) { var solution = _workspace.CurrentSolution; var activeStatementSpanProvider = new SolutionActiveStatementSpanProvider(async(documentId, cancellationToken) => { var document = solution.GetRequiredDocument(documentId); return(await _activeStatementTrackingService.GetSpansAsync(document, cancellationToken).ConfigureAwait(false)); }); var instructionId = new ActiveInstructionId(moduleId, methodToken, methodVersion, ilOffset); var span = await _encService.GetCurrentActiveStatementPositionAsync(solution, activeStatementSpanProvider, instructionId, cancellationToken).ConfigureAwait(false); return(span?.ToDebuggerSpan()); }
public async Task <DkmTextSpan?> GetCurrentActiveStatementPositionAsync(Guid moduleId, int methodToken, int methodVersion, int ilOffset, CancellationToken cancellationToken) { try { var solution = _proxy.Workspace.CurrentSolution; var activeStatementSpanProvider = new SolutionActiveStatementSpanProvider(async(documentId, cancellationToken) => { var document = solution.GetRequiredDocument(documentId); return(await _activeStatementTrackingService.GetSpansAsync(document, cancellationToken).ConfigureAwait(false)); }); var instructionId = new ManagedInstructionId(new ManagedMethodId(moduleId, new ManagedModuleMethodId(methodToken, methodVersion)), ilOffset); var span = await _proxy.GetCurrentActiveStatementPositionAsync(solution, activeStatementSpanProvider, instructionId, cancellationToken).ConfigureAwait(false); return(span?.ToSourceSpan().ToDebuggerSpan()); } catch (Exception e) when(FatalError.ReportAndCatchUnlessCanceled(e)) { return(null); } }
public SolutionActiveStatementSpanProviderCallback(SolutionActiveStatementSpanProvider solutionProvider) => _solutionProvider = solutionProvider;