Ejemplo n.º 1
0
        public void WasExit(string caller_trace)
        {
            bool wasExited     = false;
            int? exitCode      = null;
            bool wasTerminated = false;

            Func <string, bool> filter = (resJSON) => {
                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "exited"))
                {
                    wasExited = true;
                    ExitedEvent exitedEvent = JsonConvert.DeserializeObject <ExitedEvent>(resJSON);
                    exitCode = exitedEvent.body.exitCode;
                }
                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "terminated"))
                {
                    wasTerminated = true;
                }
                if (wasExited && exitCode == 0 && wasTerminated)
                {
                    return(true);
                }

                return(false);
            };

            Assert.True(VSCodeDebugger.IsEventReceived(filter), @"__FILE__:__LINE__" + "\n" + caller_trace);
        }
Ejemplo n.º 2
0
        public static void WasExit()
        {
            bool wasExited     = false;
            int? exitCode      = null;
            bool wasTerminated = false;

            Func <string, bool> filter = (resJSON) => {
                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "exited"))
                {
                    wasExited = true;
                    ExitedEvent exitedEvent = JsonConvert.DeserializeObject <ExitedEvent>(resJSON);
                    exitCode = exitedEvent.body.exitCode;
                }
                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "terminated"))
                {
                    wasTerminated = true;
                }
                if (wasExited && exitCode == 0 && wasTerminated)
                {
                    return(true);
                }

                return(false);
            };

            if (!VSCodeDebugger.IsEventReceived(filter))
            {
                throw new NetcoreDbgTestCore.ResultNotSuccessException();
            }
        }
Ejemplo n.º 3
0
        public void WasExit(string caller_trace)
        {
            bool wasExited     = false;
            bool wasTerminated = false;

            Func <string, bool> filter = (resJSON) => {
                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "exited"))
                {
                    wasExited = true;
                    ExitedEvent exitedEvent = JsonConvert.DeserializeObject <ExitedEvent>(resJSON);
                }
                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "terminated"))
                {
                    wasTerminated = true;
                }
                // we don't check exit code here, since Windows and Linux provide different exit code in case of unhandled exception
                if (wasExited && wasTerminated)
                {
                    return(true);
                }

                return(false);
            };

            Assert.True(VSCodeDebugger.IsEventReceived(filter), @"__FILE__:__LINE__" + "\n" + caller_trace);
        }
Ejemplo n.º 4
0
        public static void WasExit()
        {
            bool wasExited     = false;
            int? exitCode      = null;
            bool wasTerminated = false;

            Func <string, bool> filter = (resJSON) => {
                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "exited"))
                {
                    wasExited = true;
                    ExitedEvent exitedEvent = JsonConvert.DeserializeObject <ExitedEvent>(resJSON);
                    exitCode = exitedEvent.body.exitCode;
                }
                if (VSCodeDebugger.isResponseContainProperty(resJSON, "event", "terminated"))
                {
                    wasTerminated = true;
                }
                // we don't check exit code here, since Windows and Linux provide different exit code in case of "disconnectRequest" usage
                if (wasExited && wasTerminated)
                {
                    return(true);
                }

                return(false);
            };

            if (!VSCodeDebugger.IsEventReceived(filter))
            {
                throw new NetcoreDbgTestCore.ResultNotSuccessException();
            }
        }
Ejemplo n.º 5
0
        public bool Add(ExitedEvent oEvent)
        {
            if (HasEntered && !HasExited)
            {
                Events.Add(oEvent);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 6
0
 protected virtual void OnExited(int exitCode)
 {
     ExitedEvent?.Invoke(this, exitCode);
 }
        /// <summary>
        /// <para>The event indicates that the debuggee has exited and returns its exit code.</para>
        /// </summary>
        /// <param name="exitCode"><para>The exit code returned from the debuggee.</para></param>
        public static void SendExitedEvent(this ProtocolServer server, long exitCode)
        {
            ExitedEvent exitedEvent = new ExitedEvent(new ExitedEvent.ExitedEventBody(exitCode));

            server.SendMessage(exitedEvent);
        }
 private void OnExitedEvent(ExitedEvent e)
 {
 }