src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/Debug/ProjectDebuggerProvider.cs
/// <summary>
/// Copy information over from the contract struct to the native one.
/// </summary>
/// <returns>The native struct.</returns>
Copy information over from the contract struct to the native one.
Copy information over from the contract struct to the native one .
internal static VsDebugTargetInfo4 GetDebuggerStruct4(IDebugLaunchSettings info)
        {
            var debugInfo = new VsDebugTargetInfo4
            {
                dlo = (uint)info.LaunchOperation,
                LaunchFlags = (uint)info.LaunchOptions,
                bstrRemoteMachine = info.RemoteMachine,
                bstrArg = info.Arguments,
                bstrCurDir = info.CurrentDirectory,
                bstrExe = info.Executable,
                bstrEnv = GetSerializedEnvironmentString(info.Environment),
                guidLaunchDebugEngine = info.LaunchDebugEngineGuid
            };
            var guids = new List<Guid>(1)
            {
                info.LaunchDebugEngineGuid
            };
            if (info.AdditionalDebugEngines != null)
            {
                guids.AddRange(info.AdditionalDebugEngines);
            }
            debugInfo.dwDebugEngineCount = (uint)guids.Count;
            byte[] guidBytes = GetGuidBytes(guids);
            debugInfo.pDebugEngines = Marshal.AllocCoTaskMem(guidBytes.Length);
            Marshal.Copy(guidBytes, 0, debugInfo.pDebugEngines, guidBytes.Length);
            debugInfo.guidPortSupplier = info.PortSupplierGuid;
            debugInfo.bstrPortName = info.PortName;
            debugInfo.bstrOptions = info.Options;
            debugInfo.fSendToOutputWindow = info.SendToOutputWindow ? 1 : 0;
            debugInfo.dwProcessId = unchecked((uint)info.ProcessId);
            debugInfo.pUnknown = info.Unknown;
            debugInfo.guidProcessLanguage = info.ProcessLanguageGuid;
            if (info.StandardErrorHandle != IntPtr.Zero || info.StandardInputHandle != IntPtr.Zero || info.StandardOutputHandle != IntPtr.Zero)
            {
                var processStartupInfo = new VsDebugStartupInfo
                {
                    hStdInput = unchecked((uint)info.StandardInputHandle.ToInt32()),
                    hStdOutput = unchecked((uint)info.StandardOutputHandle.ToInt32()),
                    hStdError = unchecked((uint)info.StandardErrorHandle.ToInt32()),
                    flags = (uint)__DSI_FLAGS.DSI_USESTDHANDLES,
                };
                debugInfo.pStartupInfo = Marshal.AllocCoTaskMem(Marshal.SizeOf(processStartupInfo));
                Marshal.StructureToPtr(processStartupInfo, debugInfo.pStartupInfo, false);
            }
            debugInfo.AppPackageLaunchInfo = info.AppPackageLaunchInfo;
            debugInfo.project = info.Project;
            return debugInfo;
        }
internal static VsDebugTargetInfo4 GetDebuggerStruct4 ( IDebugLaunchSettings info ) { var debugInfo = new VsDebugTargetInfo4 { dlo = ( uint ) info . LaunchOperation , LaunchFlags = ( uint ) info . LaunchOptions , bstrRemoteMachine = info . RemoteMachine , bstrArg = info . Arguments , bstrCurDir = info . CurrentDirectory , bstrExe = info . Executable , bstrEnv = GetSerializedEnvironmentString ( info . Environment ) , guidLaunchDebugEngine = info . LaunchDebugEngineGuid } ; var guids = new List < Guid > ( 1 ) { info . LaunchDebugEngineGuid } ; if ( info . AdditionalDebugEngines != null ) { guids . AddRange ( info . AdditionalDebugEngines ) ; } debugInfo . dwDebugEngineCount = ( uint ) guids . Count ; byte [ ] guidBytes = GetGuidBytes ( guids ) ; debugInfo . pDebugEngines = Marshal . AllocCoTaskMem ( guidBytes . Length ) ; Marshal . Copy ( guidBytes , 0 , debugInfo . pDebugEngines , guidBytes . Length ) ; debugInfo . guidPortSupplier = info . PortSupplierGuid ; debugInfo . bstrPortName = info . PortName ; debugInfo . bstrOptions = info . Options ; debugInfo . fSendToOutputWindow = info . SendToOutputWindow ? 1 : 0 ; debugInfo . dwProcessId = unchecked ( ( uint ) info . ProcessId ) ; debugInfo . pUnknown = info . Unknown ; debugInfo . guidProcessLanguage = info . ProcessLanguageGuid ; if ( info . StandardErrorHandle != IntPtr . Zero || info . StandardInputHandle != IntPtr . Zero || info . StandardOutputHandle != IntPtr . Zero ) { var processStartupInfo = new VsDebugStartupInfo { hStdInput = unchecked ( ( uint ) info . StandardInputHandle . ToInt32 ( ) ) , hStdOutput = unchecked ( ( uint ) info . StandardOutputHandle . ToInt32 ( ) ) , hStdError = unchecked ( ( uint ) info . StandardErrorHandle . ToInt32 ( ) ) , flags = ( uint ) __DSI_FLAGS . DSI_USESTDHANDLES , } ; debugInfo . pStartupInfo = Marshal . AllocCoTaskMem ( Marshal . SizeOf ( processStartupInfo ) ) ; Marshal . StructureToPtr ( processStartupInfo , debugInfo . pStartupInfo , false ) ; } debugInfo . AppPackageLaunchInfo = info . AppPackageLaunchInfo ; debugInfo . project = info . Project ; return debugInfo ; }
Copy information over from the contract struct to the native one.
Copy information over from the contract struct to the native one .
// **Begin common section -- keep this in sync with GetDebuggerStruct** // **End common section**
The native struct.
The native struct .
info
IDebugLaunchSettings