/// <summary> /// Stop debugging thread. /// This may not necessarily unload islands or dynamic modules that were created until the calling appdomain has exited. /// UNDONE: Call this. Otherwise we still exit cleanly, just only when the process exits. /// </summary> internal static void Terminate() { ErrorUtilities.VerifyThrow(s_initialized, "Not initialized"); ErrorUtilities.VerifyThrow(DebuggingEnabled, "Debugging not enabled"); if (s_islandThread != null) { s_islandThread.Exit(); s_islandThread = null; } }
/// <summary> /// Starts debugger worker thread immediately, if debugging is enabled. /// This must not be called by a static constructor, as the /// time at which it is called will then be undefined, and /// the debugging environment variable might not have had a /// chance to be set. /// </summary> internal static void Initialize() { if (s_islandThread == null) { if (DebuggingEnabled) { Trace.WriteLine("MSBuild debugging enabled"); s_breakOnStartup = !String.Equals(Environment.GetEnvironmentVariable("MSBUILDDONOTBREAKONSTARTUP"), "1", StringComparison.OrdinalIgnoreCase); CreateDynamicModule(); s_islandCallback = typeof(IslandThread).GetMethod("IslandWorker", BindingFlags.Static | BindingFlags.Public); s_islandThread = new IslandThread(InvokeIsland /* delegate to invoke an island */, s_breakOnStartup); } } s_initialized = true; }
/// <summary> /// This is for internal use by MSBuild, only. /// </summary> /// <comment> /// Private Entry point called from islands. Must be public so that the islands can invoke it. /// UNDONE: Make this internal somehow. /// Called on debugger worker thread. /// </comment> public static void IslandWorker(IslandThread controller) { controller.Worker(true); }