コード例 #1
0
 static void Main(string[] args)
 {
     Console.WriteLine("Hello World!");
     Console.WriteLine("ProcId: " + args[0]);
     var processId  = int.Parse(args[0]);
     var minVersion = "0";
     var debugger   = new CLRDebugging();
     var result     = CLRDebugging.GetDebuggerForProcess(processId, minVersion);
 }
コード例 #2
0
        public static ICorDebugProcess CreateICorDebugProcess(ulong baseAddress, ICorDebugDataTarget dataTarget, ICLRDebuggingLibraryProvider libraryProvider)
        {
            Debug.Assert(baseAddress != 0);

            Version version;
            ClrDebuggingProcessFlags flags;
            ICorDebugProcess         process;
            int errorCode = new CLRDebugging().TryOpenVirtualProcess(baseAddress, dataTarget, libraryProvider, new Version(4, 6, 0x7fff, 0x7fff), out version, out flags, out process);

            if (errorCode < 0)
            {
                if (((errorCode != -2146231228) && (errorCode != -2146231226)) && (errorCode != -2146231225))
                {
                    Marshal.ThrowExceptionForHR(errorCode);
                }

                process = null;
            }

            return(process);
        }