コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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();
        }