private void HandleBreakpointHit(SledNetworkBreakpoint netBp) { IsDebugging = false; // Fire event BreakpointHit.Raise(this, new SledDebugServiceBreakpointEventArgs(netBp)); }
private void OnBreakpoint(object sender, IDebugBreakpoint e) { var breakpoint = GetBreakpoint(e); var threadId = GetCurrentThread(); if (breakpoint != null) BreakpointHit?.Invoke(breakpoint, threadId); }
internal void OnBreak(Debugger debugger, Breakpoint breakpoint) { lock (activeDebuggerLock) { if (activeDebugger != null) { throw new NotImplementedException("Multiple active debuggers."); } activeDebugger = debugger; BreakpointHitEvent.Set(); } BreakpointHit?.Invoke(this, breakpoint); }
protected virtual void OnBreakpointHit(BreakpointEventArgs e) { BreakpointHit?.Invoke(this, e); }
internal void RaiseBreakpointHit() { BreakpointHit?.Invoke(this, EventArgs.Empty); }
public int Breakpoint(IDebugBreakpoint breakpoint) { BreakpointHit?.Invoke(this, breakpoint); return((int)DEBUG_STATUS.BREAK); }
private void RaiseBreakpointHitEvent(int lineNumber) { BreakpointHit?.Invoke(this, new BreakpointHitEventArgs(lineNumber)); }
public async Task SendAsync_ShouldRetryWithNewToken_WhenRefreshedWhileRequesting() { // Arrange BreakpointHandler breakpointHandler = new BreakpointHandler { InnerHandler = _innerHandler }; Breakpoint requestBreakpoint = breakpointHandler.Breakpoint; BreakpointTokenClient breakpointTokenClient = new BreakpointTokenClient(_tokenClient); Breakpoint tokenClientBreakpoint = breakpointTokenClient.Breakpoint; UnauthorizedResponseHandler handler = new UnauthorizedResponseHandler(breakpointTokenClient, _tokenStorage, _userStorage, _logger) { InnerHandler = breakpointHandler }; HttpClient client = new HttpClient(handler) { BaseAddress = _baseAddress }; _tokenClient.RefreshTokenAsync(Arg.Any <CancellationToken>()) .Returns(ApiResponseResult <RefreshTokenResponse> .Ok( new RefreshTokenResponse { AccessToken = "New access token", RefreshToken = "New refresh token" })); HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); // Act Task task1 = Task.CompletedTask; Task task2 = Task.CompletedTask; try { // Sending first request and pausing it HttpRequestMessage request1 = new HttpRequestMessage(HttpMethod.Get, "/vpn"); task1 = client.SendAsync(request1); BreakpointHit request1Hit = await requestBreakpoint.WaitForHit().TimeoutAfter(TestTimeout); // Sending second request and pausing it HttpRequestMessage request2 = new HttpRequestMessage(HttpMethod.Get, "/profiles"); task2 = client.SendAsync(request2); BreakpointHit request2Hit = await requestBreakpoint.WaitForHit().TimeoutAfter(TestTimeout); // Continue first request and get Unauthorized _innerHandler.Expect(HttpMethod.Get, "https://api.protonvpn.ch/vpn") .Respond(HttpStatusCode.Unauthorized); request1Hit.Continue(); // First request initiated token refresh await tokenClientBreakpoint.WaitForHitAndContinue().TimeoutAfter(TestTimeout); // First request retried with new tokens request1Hit = await requestBreakpoint.WaitForHit().TimeoutAfter(TestTimeout); _innerHandler.Expect(HttpMethod.Get, "https://api.protonvpn.ch/vpn") .WithHeaders("Authorization", "Bearer New access token") .Respond(req => response); request1Hit.Continue(); await task1.TimeoutAfter(TestTimeout); // Second request continues and gets Unauthorized _innerHandler.Expect(HttpMethod.Get, "https://api.protonvpn.ch/profiles") .Respond(HttpStatusCode.Unauthorized); request2Hit.Continue(); // Second request retried with new access token request2Hit = await requestBreakpoint.WaitForHit().TimeoutAfter(TestTimeout); _innerHandler.Expect(HttpMethod.Get, "https://api.protonvpn.ch/profiles") .WithHeaders("Authorization", "Bearer New access token") .Respond(req => response); request2Hit.Continue(); } finally { await task1.TimeoutAfter(TestTimeout); await task2.TimeoutAfter(TestTimeout); } // Assert await _tokenClient.Received(1).RefreshTokenAsync(Arg.Any <CancellationToken>()); _innerHandler.VerifyNoOutstandingExpectation(); }