예제 #1
0
        protected override DisconnectResponse HandleDisconnectRequest(DisconnectArguments arguments)
        {
            debugged.Close();
            debugged = null;

            return(new DisconnectResponse());
        }
예제 #2
0
        protected override LaunchResponse HandleLaunchRequest(LaunchArguments arguments)
        {
            Protocol.RegisterRequestType <InlineVairaleRequest, InlineVariableArguments>(HandleInlineVariable);
            this.Protocol.SendEvent(new InitializedEvent());
            Protocol.SendEvent(new OutputEvent("Launching..."));
            string address = arguments.ConfigurationProperties.GetValueAsString("address");

            if (String.IsNullOrEmpty(address))
            {
                throw new ProtocolException("Launch failed because launch configuration did not specify 'address'.");
            }

            string[] token = address.Split(':');

            if (token.Length < 2)
            {
                throw new ProtocolException($"Launch failed because 'address' is invalid({address}).");
            }
            string host = token[0];
            int    port;

            if (!int.TryParse(token[1], out port))
            {
                throw new ProtocolException($"Launch failed because 'address' is invalid({address}).");
            }

            this.stopAtEntry    = arguments.ConfigurationProperties.GetValueAsBool("stopAtEntry") ?? false;
            this.hyperStepSpeed = arguments.ConfigurationProperties.GetValueAsInt("hyperStepSpeed") ?? 0;

            debugged = new DebuggedProcessVSCode(this, host, port);
            while (debugged.Connecting)
            {
                System.Threading.Thread.Sleep(10);
            }

            if (debugged.Connected)
            {
                if (debugged.CheckDebugServerVersion())
                {
                    debugged.OnDisconnected = OnDisconnected;
                    return(new LaunchResponse());
                }
                else
                {
                    debugged.Close();
                    throw new ProtocolException(String.Format("ILRuntime Debugger version mismatch\n Expected version:{0}\n Actual version:{1}", DebuggerServer.Version, debugged.RemoteDebugVersion));
                }
            }
            else
            {
                debugged = null;
                throw new ProtocolException("Cannot connect to ILRuntime");
            }
        }