Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
Resolving issue with breakpoints being deleted for all other than newest
Browse files Browse the repository at this point in the history
files.

Added error handling to breakpoints.
Updated logging for process and player connection discovery.
  • Loading branch information
miniwolf committed Oct 4, 2018
1 parent 20daa3b commit 01e57ba
Show file tree
Hide file tree
Showing 7 changed files with 1,000 additions and 849 deletions.
12 changes: 12 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ Git: https://github.com/Unity-Technologies/vscode-unity-debug
Changes
-------

2.6.6
=====
- Fix duplicate line removing breakpoints.

2.6.5
=====
- Initialize commands on vs code start up time.

2.6.4
=====
- Improve attaching to unity processes. Added support for PS4, Xbox One, and Switch.

2.6.3
=====
- Fix regression within attach unity debugger. This is necessary when EditorInstance.json does not exist.
Expand Down
2 changes: 1 addition & 1 deletion MonoDebug
Submodule MonoDebug updated 1 files
+360 −321 src/Protocol.cs
2 changes: 1 addition & 1 deletion MonoDevelop.Debugger.Soft.Unity
4 changes: 2 additions & 2 deletions UnityDebug/Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static Log ()
static string FormatMessage(string message)
{
var time = DateTime.Now.ToString ("HH:mm:ss.ffffff");
return String.Format ("{0}: {1}\n", time, message);
return $"{time}: {message}\n";
}

public static void DebugWrite(string message)
Expand All @@ -29,7 +29,7 @@ public static void DebugWrite(string message)
}

public static void Write(string message)
{
{
var formattedMessage = FormatMessage (message);
lock (logPath) {
File.AppendAllText (logPath, formattedMessage);
Expand Down
20 changes: 17 additions & 3 deletions UnityDebug/UnityAttach.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System;
using MonoDevelop.Debugger.Soft.Unity;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;

namespace UnityDebug
Expand Down Expand Up @@ -44,13 +47,24 @@ public static IEnumerable<UnityProcessInfo> GetAttachableProcesses(string target
: UnityProcessDiscovery.GetProcessOptions.Players;
}

Log.Write($"Trying to find all {options}");
var processes = UnityProcessDiscovery.GetAttachableProcesses(options);

processes.ForEach(p => Log.Write("Found Unity process: " + p.Name + " (" + p.Id + ")"));

return processId == -1
? processes.Where(p => p.Name.Contains(processName))
: processes.Where(p => p.Name.Contains(processName) && p.Id == processId);
var resProcesses = processId == -1
? processes.Where(p => p.Name.Contains(processName)).ToArray()
: processes.Where(p => p.Name.Contains(processName) && p.Id == processId).ToArray();

if (resProcesses.Length == 0)
{
Log.Write($"Could not find the correct process name: {targetName}");
Log.Write("These are the one that could be found: ");
processes = UnityProcessDiscovery.GetAttachableProcesses();
processes.ForEach(process => Log.Write($"{process.Name} : {process.Id}"));
}

return resProcesses;
}
}
}
Loading

0 comments on commit 01e57ba

Please sign in to comment.