public void EndTracking() { TrackingSession session = Interlocked.Exchange(ref _session, null); Debug.Assert(session != null, "Active statement tracking not started."); session.EndTracking(); }
public void StartTracking(EditSession editSession) { var newSession = new TrackingSession(this, editSession); if (Interlocked.CompareExchange(ref _session, newSession, null) != null) { newSession.EndTracking(); Contract.Fail("Can only track active statements for a single edit session."); } }
public async ValueTask StartTrackingAsync(Solution solution, IActiveStatementSpanProvider spanProvider, CancellationToken cancellationToken) { var newSession = new TrackingSession(_workspace, spanProvider); if (Interlocked.CompareExchange(ref _session, newSession, null) != null) { newSession.EndTracking(); Contract.Fail("Can only track active statements for a single edit session."); } await newSession.TrackActiveSpansAsync(solution, cancellationToken).ConfigureAwait(false); TrackingChanged?.Invoke(); }
public void StartTracking() { var newSession = new TrackingSession(_workspace, _workspace.Services.GetRequiredService <IEditAndContinueWorkspaceService>()); if (Interlocked.CompareExchange(ref _session, newSession, null) != null) { newSession.EndTracking(); Contract.Fail("Can only track active statements for a single edit session."); } // fire and forget on a background thread: _ = newSession.TrackActiveSpansAsync(); TrackingChanged?.Invoke(); }
public void StartTracking() { var newSession = new TrackingSession(_workspace, _spanProvider); if (Interlocked.CompareExchange(ref _session, newSession, null) != null) { newSession.EndTracking(); Contract.Fail("Can only track active statements for a single edit session."); } // fire and forget on a background thread: _ = Task.Run(() => newSession.TrackActiveSpansAsync()).ReportNonFatalErrorAsync(); TrackingChanged?.Invoke(); }