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(); }