コード例 #1
0
        private void HandleBreakpointHit(SledNetworkBreakpoint netBp)
        {
            IsDebugging = false;

            // Fire event
            BreakpointHit.Raise(this, new SledDebugServiceBreakpointEventArgs(netBp));
        }
コード例 #2
0
ファイル: WinDbgWrapper.cs プロジェクト: sihaisz/windbg-debug
 private void OnBreakpoint(object sender, IDebugBreakpoint e)
 {
     var breakpoint = GetBreakpoint(e);
     var threadId = GetCurrentThread();
     if (breakpoint != null)
         BreakpointHit?.Invoke(breakpoint, threadId);
 }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: Int3Breakpoint.cs プロジェクト: schifflee/Ladybug
 protected virtual void OnBreakpointHit(BreakpointEventArgs e)
 {
     BreakpointHit?.Invoke(this, e);
 }
コード例 #5
0
ファイル: DebugBreakpoint.cs プロジェクト: nomada2/RTVS
 internal void RaiseBreakpointHit()
 {
     BreakpointHit?.Invoke(this, EventArgs.Empty);
 }
コード例 #6
0
 public int Breakpoint(IDebugBreakpoint breakpoint)
 {
     BreakpointHit?.Invoke(this, breakpoint);
     return((int)DEBUG_STATUS.BREAK);
 }
コード例 #7
0
 private void RaiseBreakpointHitEvent(int lineNumber)
 {
     BreakpointHit?.Invoke(this, new BreakpointHitEventArgs(lineNumber));
 }
コード例 #8
0
        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();
        }