Пример #1
0
        public static bool IsEnabled(Type featureType)
        {
            bool defaultEnabled = !typeof(FeatureDisabled).IsAssignableFrom(featureType);

            return(DebugOptions.GetOption(GetFeatureName(featureType),
                                          defaultEnabled ? DebugOptions.ENABLED : DebugOptions.FEATURE_DISABLED_DEFAULT));
        }
Пример #2
0
        private void CreateDebugOptions(out UserSettings settings, out DebugOptions debugOptions, out SshDeltaCopy.Options options)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var allDeviceSettings = UserSettingsManager.Instance.Load();

            settings = allDeviceSettings.CurrentUserSettings;

            if (settings.UseDeployPathFromProjectFileIfExists)
            {
                try
                {
                    _monoExtension.OverwriteWithProjectSettingsFromStartupProject(ref settings);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                }
            }

            debugOptions = _monoExtension.CreateDebugOptions(settings);
            options      = new SshDeltaCopy.Options()
            {
                Host                     = settings.SSHHostIP,
                Port                     = settings.SSHPort,
                Username                 = settings.SSHUsername,
                Password                 = settings.SSHPassword,
                PrivateKeyFile           = settings.SSHPrivateKeyFile,
                SourceDirectory          = debugOptions.OutputDirectory,
                DestinationDirectory     = settings.SSHDeployPath,
                RemoveOldFiles           = true,
                PrintTimings             = true,
                RemoveTempDeleteListFile = true,
            };
        }
Пример #3
0
        static int RunDebug(DebugOptions options)
        {
            var engine = new DesktopEngine();

            var midiAccess = MidiAccessManager.Default;

            Console.WriteLine("MIDI Inputs");
            Console.WriteLine("-----------");
            Console.WriteLine("");
            Console.WriteLine($"\tId\tName");
            Console.WriteLine($"-----------------------------------");
            foreach (var input in midiAccess.Inputs)
            {
                Console.WriteLine($"\t{input.Id}\t{input.Name}");
            }

            Console.WriteLine();

            Console.WriteLine("MIDI Outputs");
            Console.WriteLine("------------");
            Console.WriteLine("");
            Console.WriteLine($"\tId\tName");
            Console.WriteLine($"-----------------------------------");
            foreach (var output in midiAccess.Outputs)
            {
                Console.WriteLine($"\t{output.Id}\t{output.Name}");
            }

            return(0);
        }
        private void Clone(object source, EventArgs args)
        {
            var container = Model.Container;

            var current = container.Current;
            var cloned  = new DebugOptions(container)
            {
                HostAddress                     = current.HostAddress,
                DebugPort                       = current.DebugPort,
                RunAsDebugServer                = current.RunAsDebugServer,
                MaxConnectionAttempts           = current.MaxConnectionAttempts,
                TimeBetweenConnectionAttemptsMs = current.TimeBetweenConnectionAttemptsMs
            };

            var idx  = 1;
            var name = current.AppName + " Clone  ";

            while (container.Profiles.Any(p => p.AppName == name.Trim()))
            {
                name = $"{name.Substring(0, name.Length-(idx.ToString().Length)).Trim()} {idx++}";
            }

            cloned.AppName = name.Trim();
            container.Profiles.Add(cloned);
            container.SelectedName = cloned.AppName;
        }
        public DebugOptions CreateDebugOptions(UserSettings settings, bool useSSH = false)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var startupAssemblyPath = GetStartupAssemblyPath();
            var targetExeFileName   = Path.GetFileName(startupAssemblyPath);
            var outputDirectory     = Path.GetDirectoryName(startupAssemblyPath);
            var startArguments      = GetStartArguments();
            var preDebugScript      = settings.PreDebugScriptWithParameters
                                      .Replace(settings.MONO_DEBUG_PORT, settings.SSHMonoDebugPort.ToString())
                                      .Replace(settings.TARGET_EXE_FILENAME, targetExeFileName)
                                      .Replace(settings.START_ARGUMENTS, startArguments)
                                      .Replace("\r\n", "\n");
            var debugScript = settings.DebugScriptWithParameters
                              .Replace(settings.MONO_DEBUG_PORT, settings.SSHMonoDebugPort.ToString())
                              .Replace(settings.TARGET_EXE_FILENAME, targetExeFileName)
                              .Replace(settings.START_ARGUMENTS, startArguments)
                              .Replace("\r\n", "\n");

            var debugOptions = new DebugOptions()
            {
                UseSSH = useSSH,
                StartupAssemblyPath = startupAssemblyPath,
                UserSettings        = settings,
                OutputDirectory     = outputDirectory,
                TargetExeFileName   = targetExeFileName,
                StartArguments      = startArguments,
                PreDebugScript      = preDebugScript,
                DebugScript         = debugScript,
            };

            return(debugOptions);
        }
Пример #6
0
 void updateAll()
 {
     if (inputManager.InputAccept())
     {
         if (currentSelection == 0)
         {
             currentSelection = 0;
             maxSelection     = 2;
             currentOption    = DebugOptions.Display;
         }
         else if (currentSelection == 1)
         {
             currentSelection = 0;
             maxSelection     = 4;
             currentOption    = DebugOptions.Score;
         }
         else if (currentSelection == 2)
         {
             currentSelection = 0;
             maxSelection     = 7;
             currentOption    = DebugOptions.Player;
         }
         else if (currentSelection == 3)
         {
             currentSelection = 0;
             maxSelection     = 2;
             currentOption    = DebugOptions.Save;
         }
     }
 }
        //public static string ComputeHash(string file)
        //{
        //    using (FileStream stream = File.OpenRead(file))
        //    {
        //        var sha = new SHA256Managed();
        //        byte[] checksum = sha.ComputeHash(stream);
        //        return BitConverter.ToString(checksum).Replace("-", string.Empty);
        //    }
        //}

        private IntPtr GetDebugInfo(DebugOptions debugOptions)//string args, int debugPort, string targetExe, string outputDirectory)
        {
            var info = new VsDebugTargetInfo()
            {
                //cbSize = (uint)Marshal.SizeOf(info),
                dlo               = DEBUG_LAUNCH_OPERATION.DLO_CreateProcess,
                bstrExe           = debugOptions.StartupAssemblyPath,
                bstrCurDir        = debugOptions.OutputDirectory,
                bstrArg           = debugOptions.StartArguments,
                bstrRemoteMachine = null,                                                  // debug locally
                grfLaunch         = (uint)__VSDBGLAUNCHFLAGS.DBGLAUNCH_StopDebuggingOnEnd, // When this process ends, debugging is stopped.
                //grfLaunch = (uint)__VSDBGLAUNCHFLAGS.DBGLAUNCH_DetachOnStop, // Detaches instead of terminating when debugging stopped.
                fSendStdoutToOutputWindow = 0,
                clsidCustom = DebugEngineGuids.EngineGuid,
                //bstrEnv = "",
                bstrOptions = debugOptions.SerializeToJson() // add debug engine options
            };

            if (DebugEngineGuids.UseAD7Engine == EngineType.XamarinEngine)
            {
                info.bstrPortName      = "Mono";
                info.clsidPortSupplier = DebugEngineGuids.ProgramProviderGuid;
            }

            info.cbSize = (uint)Marshal.SizeOf(info);

            IntPtr pInfo = Marshal.AllocCoTaskMem((int)info.cbSize);

            Marshal.StructureToPtr(info, pInfo, false);
            return(pInfo);
        }
        public DebugOptions CreateDebugOptions(UserSettings settings)
        {
            NLogService.TraceEnteringMethod();

            ThreadHelper.ThrowIfNotOnUIThread();

            var startupAssemblyPath = GetStartupAssemblyPath();
            var targetExeFileName   = Path.GetFileName(startupAssemblyPath);
            var outputDirectory     = Path.GetDirectoryName(startupAssemblyPath);
            var startArguments      = GetStartArguments();

            var preDebugScript = settings.DeployAndDebugOnLocalWindowsSystem ? settings.PreDebugScriptWithParametersWindows : settings.PreDebugScriptWithParameters;

            preDebugScript = ReplaceDebugParameters(preDebugScript, settings, targetExeFileName, startArguments, "\n");

            var debugScript = settings.DeployAndDebugOnLocalWindowsSystem ? settings.DebugScriptWithParametersWindows : settings.DebugScriptWithParameters;

            debugScript = ReplaceDebugParameters(debugScript, settings, targetExeFileName, startArguments, "\n");

            var debugOptions = new DebugOptions()
            {
                StartupAssemblyPath = startupAssemblyPath,
                UserSettings        = settings,
                OutputDirectory     = outputDirectory,
                TargetExeFileName   = targetExeFileName,
                StartArguments      = startArguments,
                PreDebugScript      = preDebugScript,
                DebugScript         = debugScript,
            };

            return(debugOptions);
        }
        private IntPtr GetDebugInfo(DebugOptions debugOptions)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var startupAssemblyPath = GetStartupAssemblyPath();
            var targetExeFileName   = Path.GetFileName(startupAssemblyPath);
            var outputDirectory     = Path.GetDirectoryName(startupAssemblyPath);

            var info = new VsDebugTargetInfo()
            {
                //cbSize = (uint)Marshal.SizeOf(info),
                dlo               = DEBUG_LAUNCH_OPERATION.DLO_CreateProcess,
                bstrExe           = targetExeFileName,
                bstrCurDir        = outputDirectory,
                bstrArg           = GetStartArguments(),
                bstrRemoteMachine = null,                                                  // debug locally
                grfLaunch         = (uint)__VSDBGLAUNCHFLAGS.DBGLAUNCH_StopDebuggingOnEnd, // When this process ends, debugging is stopped.
                //grfLaunch = (uint)__VSDBGLAUNCHFLAGS.DBGLAUNCH_DetachOnStop, // Detaches instead of terminating when debugging stopped.
                fSendStdoutToOutputWindow = 0,
                clsidCustom = DebugEngineGuids.EngineGuid,
                //bstrEnv = "",
                bstrOptions       = debugOptions.SerializeToJson(), // add debug engine options
                bstrPortName      = "Mono",
                clsidPortSupplier = DebugEngineGuids.ProgramProviderGuid
            };

            info.cbSize = (uint)Marshal.SizeOf(info);

            IntPtr pInfo = Marshal.AllocCoTaskMem((int)info.cbSize);

            Marshal.StructureToPtr(info, pInfo, false);
            return(pInfo);
        }
Пример #10
0
        public void WatchItems <TypedItem>(IFolder folder, TypedItemEventHandler <TypedItem> handler, bool reportExisting)
            where TypedItem : IItem
        {
            if (!DebugOptions.GetOption(null, DebugOptions.WATCHER_ENABLED))
            {
                return;
            }

            // Must have a ZPush folder to watch events.
            ZPushFolder zPushFolder = folder.ZPush;

            // Register the handlers
            ItemsWatcher watcher = zPushFolder.ItemsWatcher();

            watcher.ItemEvent += (item) =>
            {
                if (item is TypedItem)
                {
                    handler((TypedItem)item);
                }
            };

            // Report existing if requested
            if (reportExisting)
            {
                zPushFolder.ReportExistingItems(handler);
            }
        }
Пример #11
0
        private static int Debug(DebugOptions options)
        {
            BaseliningTester tester = new BaseliningTester();

            tester.RunSeries(Path.Combine(options.TestRootPath, BaseliningTester.InputFolderName, options.DebugSeriesPath), options.DebugSeriesPath, options.DebugLogIndex, options.DebugResultIndex);

            return(0);
        }
Пример #12
0
 public MainDialog(IDialogFactory dialogFactory, ICrmService crmService, string personId,
                   DebugOptions debugOptions = DebugOptions.None)
 {
     this.dialogFactory = dialogFactory;
     this.crmService    = crmService;
     this.personId      = personId;
     this.debugOptions  = debugOptions;
 }
        internal async Task AttachDebugger(DebugOptions debugOptions)
        {
            string appHash = ComputeHash(debugOptions.StartupAssemblyPath);

            Project startup = GetStartupProject();

            bool            isWeb   = ((object[])startup.ExtenderNames).Any(x => x.ToString() == "WebApplication");
            ApplicationType appType = isWeb ? ApplicationType.Webapplication : ApplicationType.Desktopapplication;

            if (appType == ApplicationType.Webapplication)
            {
                debugOptions.OutputDirectory += @"\..\..\";
            }

            var          client  = new DebugClient(appType, debugOptions.TargetExeFileName, debugOptions.StartArguments, debugOptions.OutputDirectory, appHash);
            DebugSession session = await client.ConnectToServerAsync(debugOptions.UserSettings.LastIp);

            var debugSessionStarted = await session.RestartDebuggingAsync(debugOptions.UserSettings.LastTimeout);

            if (!debugSessionStarted)
            {
                await session.TransferFilesAsync();

                await session.WaitForAnswerAsync(debugOptions.UserSettings.LastTimeout);
            }

            IntPtr pInfo = GetDebugInfo(debugOptions);
            var    sp    = new ServiceProvider((IServiceProvider)_dte);

            try
            {
                var dbg = (IVsDebugger)sp.GetService(typeof(SVsShellDebugger));
                int hr  = dbg.LaunchDebugTargets(1, pInfo);
                Marshal.ThrowExceptionForHR(hr);

                DebuggedProcess.Instance.AssociateDebugSession(session);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                string msg;
                var    sh = (IVsUIShell)sp.GetService(typeof(SVsUIShell));
                sh.GetErrorInfo(out msg);

                if (!string.IsNullOrWhiteSpace(msg))
                {
                    logger.Error(msg);
                }
                throw;
            }
            finally
            {
                if (pInfo != IntPtr.Zero)
                {
                    Marshal.FreeCoTaskMem(pInfo);
                }
            }
        }
 public MessageContextDispatcher(
     ILogger <MessageContextDispatcher> logger,
     IMessageContextFactory factory,
     IOptions <DebugOptions> debugOptions)
 {
     _logger       = logger;
     _factory      = factory;
     _debugOptions = debugOptions.Value;
 }
Пример #15
0
    void Awake()
    {
        SceneManager.sceneLoaded += OnSceneLoaded;

        _debugOptions = GetComponent <DebugOptions>();
        _debugOptions.Options.AddRange(_options);

        ApplyCurrentSettings();
    }
Пример #16
0
 public static void DebugOn()
 {
     Debug = new DebugOptions
     {
         AssertsWithStacks = false, DrawGraphEdges = false, DrawGraphNodes = false, DrawBogiePhysics = true,
         DrawBendyPhysics  = false, DrawSwitchControllers = true, DrawBogieEdges = true, DrawGradingShapes = true
     };
     DebugCommit();
 }
Пример #17
0
        private string SerializeDebuggerOptions(string jsonDebugOptions)
        {
            try
            {
                NLogService.TraceEnteringMethod(Logger);
                var debugOptions = DebugOptions.DeserializeFromJson(jsonDebugOptions);

                _session = new MonoDebugSession();

                LogMonoDebuggerAssemblyPaths();

                if (debugOptions.UserSettings.EnableVerboseDebugLogging)
                {
                    RegisterEventHandlers();
                }

                var connectionTimeout = 30000;
                var evaluationTimeout = 30000;
                var startupProject    = StartupProject;
                XamarinEngine.DebugOptions = debugOptions;
                var softDebuggerConnectArgs = new SoftDebuggerConnectArgs(debugOptions.TargetExeFileName, debugOptions.GetHostIP(), debugOptions.GetMonoDebugPort());

                // TODO implement programm output via stream
                //softDebuggerConnectArgs.RedirectOutput = true;
                //softDebuggerConnectArgs.OutputPort = ???;
                //_session.VirtualMachine.StandardOutput ???

                softDebuggerConnectArgs.TimeBetweenConnectionAttempts = (int)debugOptions.UserSettings.TimeBetweenConnectionAttemptsInMs;
                softDebuggerConnectArgs.MaxConnectionAttempts         = (int)debugOptions.UserSettings.MaxConnectionAttempts;

                _startInfo = new StartInfo(
                    softDebuggerConnectArgs,
                    new DebuggingOptions()
                {
                    EvaluationTimeout       = evaluationTimeout,
                    MemberEvaluationTimeout = evaluationTimeout,
                    ModificationTimeout     = evaluationTimeout,
                    SocketTimeout           = connectionTimeout
                },
                    startupProject
                    );

                SessionMarshalling sessionMarshalling = new SessionMarshalling(_session, _startInfo);
                using (MemoryStream ms = new MemoryStream())
                {
                    BinaryFormatter bf   = new BinaryFormatter();
                    ObjRef          oref = RemotingServices.Marshal(sessionMarshalling);
                    bf.Serialize(ms, oref);
                    return(Convert.ToBase64String(ms.ToArray()));
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw;
            }
        }
 // Start is called before the first frame update
 new void Start()
 {
     debugOptions    = FindObjectOfType <DebugOptions>();
     attackRigidbody = attack.GetComponent <Rigidbody2D>();
     if (!attackRigidbody)
     {
         Debug.LogError("No rigidbody found on attack, did you forget to give the enemy an attack?");
     }
     base.Start();
 }
Пример #19
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == typeof(string))
     {
         // Show full registry string
         Feature feature = value as Feature;
         return(DebugOptions.GetOptions(feature?.Name));
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
Пример #20
0
        public MapperOptions()
        {
            Strictness = new MapperStrictnessOptions
            {
                ThrowWithoutCorrespondingSourceMember = false
            };

            Conventions = new MapperConventionOptions
            {
                CallToStringWhenDestinationIsString     = true,
                AutomaticallyFlattenHierarchies         = true,
                MakeCloneIfDestinationIsTheSameAsSource = true,
                IgnoreMemberAttributeShouldBeRespected  = true,
                ReuseNonNullComplexMembersOnDestination = true,
                IgnoreCaseWhenFindingMatch         = true,
                IgnoreMembersWithNullValueOnSource = false,
                PreserveDestinationListContents    = true,
                MaxDepth = null
            };

            Safety = new MapperSafetyOptions
            {
                PerformNullChecksOnCustomMappings = true,
                IfSourceIsNull = SourceObjectNullOptions.ReturnNullWhenSourceIsNull,
                IfRecursiveRelationshipIsDetected = RecursivePropertyOptions.IgnoreRecursiveProperties,
                ThrowIfDestinationIsNull          = true,
                EnsureCollectionIsNotArrayType    = true,
                UseDefaultValueForMissingVariable = true
            };

            Compilation = new CompilationOptions
            {
                CompileToDynamicAssembly = true
            };

            Projection = new ProjectionOptions
            {
                MapCollectionMembers = true
            };

            Cloning = new CloneOptions
            {
                MaxCloneDepth = 2,
            };

            Debug = new DebugOptions
            {
#if DEBUG
                DebugInformationEnabled = true
#else
                DebugInformationEnabled = false
#endif
            };
        }
    }
Пример #21
0
 private void Start()
 {
     deathBehaviors = GetComponents <DeathBehavior>();
     debugOptions   = FindObjectOfType <DebugOptions>();
     if (GetComponent <MainCharacter>())
     {
         MaximumHealth = FindObjectOfType <GameSession>().currentMaximumHealth;
     }
     CurrentHealth = MaximumHealth;
     SetGameStatId(GameStats.STAT_HEALTH);
 }
Пример #22
0
        public bool Start(string filename, string cmdLine, string cwd, BreakProcessKind breakKind)
        {
            var options = new DebugOptions {
                Filename         = filename,
                CommandLine      = cmdLine,
                CurrentDirectory = cwd,
                BreakProcessKind = breakKind,
            };

            return(Start(options));
        }
Пример #23
0
        public DebugMenu(SpriteFont fnt, InputManager im, SaveData sd, Level lvl)
        {
            font         = fnt;
            inputManager = im;
            saveData     = sd;
            level        = lvl;

            currentOption    = DebugOptions.All;
            currentSelection = 0;
            maxSelection     = 4;
        }
Пример #24
0
    public static DebugOptions GetInstance()
    {
        if(h_Instance == null)
        {
            h_Instance = GameObject.FindObjectOfType<DebugOptions>();

            if (h_Instance == null)
                Debug.LogWarning("DebugOptions instance is being requested, but no object has been found using it");

        }
        return h_Instance;
    }
Пример #25
0
		public static DBG.DebugProcessOptions Convert(DebugOptions options, IDebuggerSettings settings, DBG.CLRTypeDebugInfo info) {
			if (options == null)
				throw new ArgumentNullException();
			var o = new DBG.DebugProcessOptions(info);
			o.Filename = options.Filename;
			o.CommandLine = options.CommandLine;
			o.CurrentDirectory = options.CurrentDirectory;
			o.DebugMessageDispatcher = WpfDebugMessageDispatcher.Instance;
			o.BreakProcessKind = Convert(options.BreakProcessKind);
			o.DebugOptions.IgnoreBreakInstructions = settings.IgnoreBreakInstructions;
			return o;
		}
Пример #26
0
    public static DebugOptions GetInstance()
    {
        if (h_Instance == null)
        {
            h_Instance = GameObject.FindObjectOfType <DebugOptions>();

            if (h_Instance == null)
            {
                Debug.LogWarning("DebugOptions instance is being requested, but no object has been found using it");
            }
        }
        return(h_Instance);
    }
Пример #27
0
 public DebugProcessOptions CopyTo(DebugProcessOptions other)
 {
     other.CLRTypeDebugInfo       = CLRTypeDebugInfo.Clone();
     other.Filename               = Filename;
     other.CommandLine            = CommandLine;
     other.CurrentDirectory       = CurrentDirectory;
     other.InheritHandles         = InheritHandles;
     other.ProcessCreationFlags   = ProcessCreationFlags;
     other.DebugMessageDispatcher = DebugMessageDispatcher;
     other.DebugOptions           = DebugOptions == null ? null : DebugOptions.Clone();
     other.BreakProcessKind       = BreakProcessKind;
     return(other);
 }
Пример #28
0
        public GridXZ(int width, int height, float cellSize, Vector3 gridOrigin = default, T startingValue = default, bool debug = false, DebugOptions?debugOptions = null)
        {
            this.width      = width;
            this.height     = height;
            this.cellSize   = cellSize;
            this.gridOrigin = gridOrigin;

            grid = new T[width, height];
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    grid[x, y] = startingValue;
                }
            }

            if (!debug)
            {
                return;
            }

            if (debugOptions == null)
            {
                debugOptions = new DebugOptions();
            }
            Quaternion rotation = Quaternion.Euler(90, 0, 0);

            if (debugOptions.Value.ShowText)
            {
                debugText = new TextMeshPro[width, height];
            }
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    Debug.DrawLine(GetWorldCoordinates(x, y), GetWorldCoordinates(x, y + 1), Color.white, debugOptions.Value.LineDuration, false);
                    Debug.DrawLine(GetWorldCoordinates(x, y), GetWorldCoordinates(x + 1, y), Color.white, debugOptions.Value.LineDuration, false);

                    if (debugOptions.Value.ShowText)
                    {
                        debugText[x, y] = Utils.CreateWorldText(grid[x, y].ToString(), position: GetWorldCoordinates(x, y) + new Vector3(cellSize, cellSize) * 0.5f,
                                                                fontSize: debugOptions.Value.FontSize, rotation: rotation, horizontalAlignment: HorizontalAlignmentOptions.Center,
                                                                verticalAlignment: VerticalAlignmentOptions.Middle);
                    }
                }
            }

            Debug.DrawLine(GetWorldCoordinates(0, height), GetWorldCoordinates(width, height), Color.white, debugOptions.Value.LineDuration, false);
            Debug.DrawLine(GetWorldCoordinates(width, 0), GetWorldCoordinates(width, height), Color.white, debugOptions.Value.LineDuration, false);
            OnGridValueChanged += args => { debugText[args.X, args.Y].text = args.NewValue.ToString(); };
        }
Пример #29
0
        internal static void AttachDebugger(DebugOptions options)
        {
            if (options == DebugOptions.No)
            {
                return;
            }
#if DEBUG
            if (!Debugger.IsAttached)
            {
                if (options == DebugOptions.Prompt)
                {
                    var response = Prompt.GetYesNo(
                        "Do you wish to debug? Attach now or press [Y] and [ENTER] to attach. Press [N] or [ENTER] to continue.",
                        defaultAnswer: false,
                        promptColor: ConsoleColor.Cyan);
                    options = response ? DebugOptions.Yes : DebugOptions.No;
                }

                if (options == DebugOptions.Yes || options == DebugOptions.YesSilent)
                {
                    var vsProcess =
                        VisualStudioAttacher.GetVisualStudioForSolutions(
                            new List <string> {
                        "AudioAnalysis.sln"
                    });

                    if (vsProcess != null)
                    {
                        VisualStudioAttacher.AttachVisualStudioToProcess(vsProcess, Process.GetCurrentProcess());
                    }
                    else
                    {
                        // try and attach the old fashioned way
                        Debugger.Launch();
                    }
                }

                // ReSharper disable once ConditionIsAlwaysTrueOrFalse
                if (Debugger.IsAttached)
                {
                    if (options != DebugOptions.YesSilent)
                    {
                        LoggedConsole.WriteLine("\t>>> Attach sucessful");
                        LoggedConsole.WriteLine();
                    }
                }
            }
#endif
        }
        private void CreateDebugOptions(out UserSettings settings, out DebugOptions debugOptions, out SshDeltaCopy.Options options)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            var allDeviceSettings = UserSettingsManager.Instance.Load();

            settings = allDeviceSettings.CurrentUserSettings;

            if (settings.UseDeployPathFromProjectFileIfExists)
            {
                try
                {
                    var localProjectConfig = _monoExtension.GetProjectSettingsFromStartupProject();
                    if (localProjectConfig.HasValue)
                    {
                        if (!string.IsNullOrWhiteSpace(localProjectConfig.Value.SSHDeployPath))
                        {
                            Logger.Info($"SSHDeployPath = {settings.SSHDeployPath} was overwritten with local *.VSMonoDebugger.config: {localProjectConfig.Value.SSHDeployPath}");
                            settings.SSHDeployPath = localProjectConfig.Value.SSHDeployPath;
                        }
                        if (!string.IsNullOrWhiteSpace(localProjectConfig.Value.WindowsDeployPath))
                        {
                            Logger.Info($"WindowsDeployPath = {settings.WindowsDeployPath} was overwritten with local *.VSMonoDebugger.config: {localProjectConfig.Value.WindowsDeployPath}");
                            settings.WindowsDeployPath = localProjectConfig.Value.WindowsDeployPath;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                }
            }

            debugOptions = _monoExtension.CreateDebugOptions(settings);
            options      = new SshDeltaCopy.Options()
            {
                Host                     = settings.SSHHostIP,
                Port                     = settings.SSHPort,
                Username                 = settings.SSHUsername,
                Password                 = settings.SSHPassword,
                PrivateKeyFile           = settings.SSHPrivateKeyFile,
                SourceDirectory          = debugOptions.OutputDirectory,
                DestinationDirectory     = settings.SSHDeployPath,
                RemoveOldFiles           = true,
                PrintTimings             = true,
                RemoveTempDeleteListFile = true,
            };
        }
        public void AttachDebuggerToRunningProcess(DebugOptions debugOptions)
        {
            NLogService.TraceEnteringMethod();

            ThreadHelper.ThrowIfNotOnUIThread();

            if (DebugEngineGuids.UseAD7Engine == EngineType.XamarinEngine)
            {
                // Workaround to get StartProject
                XamarinEngine.StartupProject = GetStartupProject();
            }

            IntPtr pInfo = GetDebugInfo(debugOptions);
            var    sp    = new ServiceProvider((IServiceProvider)_dte);

            try
            {
                var dbg = sp.GetService(typeof(SVsShellDebugger)) as IVsDebugger;
                if (dbg == null)
                {
                    logger.Error($"GetService did not returned SVsShellDebugger");
                }
                int hr = dbg.LaunchDebugTargets(1, pInfo);
                Marshal.ThrowExceptionForHR(hr);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                string msg = null;
                var    sh  = sp.GetService(typeof(SVsUIShell)) as IVsUIShell;
                if (sh != null)
                {
                    sh.GetErrorInfo(out msg);
                }
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    logger.Error(msg);
                }
                throw;
            }
            finally
            {
                if (pInfo != IntPtr.Zero)
                {
                    Marshal.FreeCoTaskMem(pInfo);
                }
            }
        }
Пример #32
0
        public static DBG.DebugProcessOptions Convert(DebugOptions options, IDebuggerSettings settings, DBG.CLRTypeDebugInfo info)
        {
            if (options == null)
            {
                throw new ArgumentNullException();
            }
            var o = new DBG.DebugProcessOptions(info);

            o.Filename               = options.Filename;
            o.CommandLine            = options.CommandLine;
            o.CurrentDirectory       = options.CurrentDirectory;
            o.DebugMessageDispatcher = WpfDebugMessageDispatcher.Instance;
            o.BreakProcessKind       = Convert(options.BreakProcessKind);
            o.DebugOptions.IgnoreBreakInstructions = settings.IgnoreBreakInstructions;
            return(o);
        }
Пример #33
0
		public bool Start(DebugOptions options) =>
			dispatcher.UI(() => debugService.Value.DebugAssembly(Utils.Convert(options, debugService.Value.DebuggerSettings, new DBG.DesktopCLRTypeDebugInfo())));
Пример #34
0
		public AttachProcessOptions() {
			this.DebugOptions = new DebugOptions();
		}
Пример #35
0
		public DebugProcessOptions(CLRTypeDebugInfo info) {
			CLRTypeDebugInfo = info;
			DebugOptions = new DebugOptions();
			BreakProcessKind = BreakProcessKind.None;
		}
Пример #36
0
		/// <summary>
		/// Constructor
		/// </summary>
		public CoreCLRDebugOptions() {
			Options = new DebugOptions();
		}
Пример #37
0
		public AttachProcessOptions(CLRTypeAttachInfo info) {
			this.DebugOptions = new DebugOptions();
			this.CLRTypeAttachInfo = info;
		}
Пример #38
0
		/// <summary>
		/// Calls CRYPTO_dbg_set_options()
		/// </summary>
		/// <param name="options"></param>
		public static void SetDebugOptions(DebugOptions options)
		{
			Native.CRYPTO_dbg_set_options((int)options);
		}
Пример #39
0
		public bool Start(string filename, string cmdLine, string cwd, BreakProcessKind breakKind) {
			var options = new DebugOptions {
				Filename = filename,
				CommandLine = cmdLine,
				CurrentDirectory = cwd,
				BreakProcessKind = breakKind,
			};
			return Start(options);
		}