Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Ward <matt.ward@microsoft.com>2020-01-22 15:34:47 +0300
committerMatt Ward <matt.ward@microsoft.com>2020-01-22 17:30:23 +0300
commit18f6524b63123ade916831bdd9f2b7b3d7016957 (patch)
treeb36bff24cbb1b940cad5ca9f5613280bea72453b
parentd02f67c11fa055b67b5e55c0b344706a49ec1e40 (diff)
[Debugger] Provide project to DebuggerSession mapping
The DebuggerService now has two methods that can map from an IRunTarget to a DebuggerSession or the other way around. The ExecutionCommand now has an IRunTarget property which is used by the DebuggerService to create this mapping from DebuggerSession to IRunTarget. IRunTarget is implemented by SolutionItem. Fixes VSTS #1012614 - Improvements to DebuggerSession for XAML Hot Reload
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs22
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ExecutionCommand.cs8
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs5
3 files changed, 33 insertions, 2 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
index 8fb53e652f..60d5fa309f 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
@@ -149,6 +149,26 @@ namespace MonoDevelop.Debugger
return sessions.Keys.ToArray ();
}
+ public static DebuggerSession GetSession (IRunTarget runTarget)
+ {
+ foreach (KeyValuePair<DebuggerSession, SessionManager> item in sessions.ToArray ()) {
+ if (item.Value.RunTarget == runTarget) {
+ return item.Key;
+ }
+ }
+ return null;
+ }
+
+ public static IRunTarget GetRunTarget (DebuggerSession session)
+ {
+ foreach (KeyValuePair<DebuggerSession, SessionManager> item in sessions.ToArray ()) {
+ if (item.Key == session) {
+ return item.Value.RunTarget;
+ }
+ }
+ return null;
+ }
+
public static ProcessInfo [] GetProcesses ()
{
return sessions.Keys.Where (s => !s.IsRunning).SelectMany (s => s.GetProcesses ()).ToArray ();
@@ -721,6 +741,7 @@ namespace MonoDevelop.Debugger
sessionManager = new SessionManager (session, IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor (System.IO.Path.GetFileNameWithoutExtension (startInfo.Command)).Console, factory, timer);
else
sessionManager = new SessionManager (session, c, factory, timer);
+ sessionManager.RunTarget = cmd.RunTarget;
SetupSession (sessionManager);
SetDebugLayout ();
@@ -757,6 +778,7 @@ namespace MonoDevelop.Debugger
public readonly DebuggerSession Session;
public readonly DebugAsyncOperation debugOperation;
public readonly DebuggerEngine Engine;
+ internal IRunTarget RunTarget { get; set; }
internal ITimeTracker<DebuggerStartMetadata> StartTimer { get; set; }
internal bool TrackActionTelemetry { get; set; }
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ExecutionCommand.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ExecutionCommand.cs
index 3db966161d..93fb1343d4 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ExecutionCommand.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ExecutionCommand.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using System;
+using MonoDevelop.Projects;
namespace MonoDevelop.Core.Execution
{
@@ -46,5 +46,11 @@ namespace MonoDevelop.Core.Execution
/// Execution target. For example, a specific device.
/// </summary>
public ExecutionTarget Target { get; set; }
+
+ /// <summary>
+ /// IRunTarget item associated with this execution command. This allows the DebuggerSession to be
+ /// associated with an IRunTarget (typically a Project).
+ /// </summary>
+ public IRunTarget RunTarget { get; set; }
}
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs
index 8712a31c23..8c826d0fb2 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs
@@ -1505,7 +1505,10 @@ namespace MonoDevelop.Projects
public ExecutionCommand CreateExecutionCommand (ConfigurationSelector configSel, DotNetProjectConfiguration configuration, ProjectRunConfiguration runConfiguration)
{
- return ProjectExtension.OnCreateExecutionCommand (configSel, configuration, runConfiguration);
+ var command = ProjectExtension.OnCreateExecutionCommand (configSel, configuration, runConfiguration);
+ if (command != null)
+ command.RunTarget ??= this;
+ return command;
}
internal protected virtual ExecutionCommand OnCreateExecutionCommand (ConfigurationSelector configSel, DotNetProjectConfiguration configuration)