//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);
        }
        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);
        }