From bb2520a64a93958cdb4093de06405eff425406bd Mon Sep 17 00:00:00 2001 From: Michael DeRoy Date: Tue, 28 Nov 2017 09:58:34 -0500 Subject: [PATCH 1/3] fixes some issues --- UnityMixedCallstackFilter.cs | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/UnityMixedCallstackFilter.cs b/UnityMixedCallstackFilter.cs index 2ee0a63..7157ff2 100644 --- a/UnityMixedCallstackFilter.cs +++ b/UnityMixedCallstackFilter.cs @@ -23,9 +23,15 @@ public class UnityMixedCallstackFilter : IDkmCallStackFilter, IDkmLoadCompleteNo public void OnLoadComplete(DkmProcess process, DkmWorkList workList, DkmEventDescriptor eventDescriptor) { - IVsOutputWindow outWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; - Guid debugPaneGuid = VSConstants.GUID_OutWindowDebugPane; - outWindow.GetPane(ref debugPaneGuid, out _debugPane); + _enabled = true; + DisposeStreams(); + + if (_debugPane != null) + { + IVsOutputWindow outWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; + Guid debugPaneGuid = VSConstants.GUID_OutWindowDebugPane; + outWindow.GetPane(ref debugPaneGuid, out _debugPane); + } var env = Environment.GetEnvironmentVariable("UNITY_MIXED_CALLSTACK"); if (env == null || env == "0") // plugin not enabled @@ -89,7 +95,13 @@ private static int GetFileNameSequenceNum(string path) private static void DisposeStreams() { _fileStreamReader?.Dispose(); + _fileStreamReader = null; + _fileStream?.Dispose(); + _fileStream = null; + + _currentFile = null; + _rangesSortedByIp.Clear(); } @@ -126,9 +138,9 @@ private static void RefreshStackData(int pid) } catch (Exception ex) { - _currentFile = null; _debugPane.OutputString("Unable to read dumped pmip file: " + ex.Message + "\n"); DisposeStreams(); + _enabled = false; return; } } @@ -157,6 +169,9 @@ private static void RefreshStackData(int pid) catch (Exception ex) { _debugPane.OutputString("Unable to read dumped pmip file: " + ex.Message + "\n"); + DisposeStreams(); + _enabled = false; + return; } _rangesSortedByIp.Sort((r1, r2) => r1.Start.CompareTo(r2.Start)); From 4f7ea1c20b9554a9fffc6f58912fe83d7c66856e Mon Sep 17 00:00:00 2001 From: Michael DeRoy Date: Tue, 28 Nov 2017 10:12:51 -0500 Subject: [PATCH 2/3] fix null check --- UnityMixedCallstackFilter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnityMixedCallstackFilter.cs b/UnityMixedCallstackFilter.cs index 7157ff2..411e9a1 100644 --- a/UnityMixedCallstackFilter.cs +++ b/UnityMixedCallstackFilter.cs @@ -26,7 +26,7 @@ public void OnLoadComplete(DkmProcess process, DkmWorkList workList, DkmEventDes _enabled = true; DisposeStreams(); - if (_debugPane != null) + if (_debugPane == null) { IVsOutputWindow outWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; Guid debugPaneGuid = VSConstants.GUID_OutWindowDebugPane; From cf6726e55baa4d8010136aaedecd3637d7a67a71 Mon Sep 17 00:00:00 2001 From: Michael DeRoy Date: Thu, 30 Nov 2017 13:26:28 -0500 Subject: [PATCH 3/3] Add VS2017 Support --- .gitignore | 1 + UnityMixedCallstack.csproj | 17 ++++++++++++++++- packages.config | 4 ++++ source.extension.vsixmanifest | 7 +++++-- 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 packages.config diff --git a/.gitignore b/.gitignore index c190389..3d720bd 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ obj **/test-results/* *Resharper* Mono.Cecil.sln.ide* +packages/ \ No newline at end of file diff --git a/UnityMixedCallstack.csproj b/UnityMixedCallstack.csproj index bb82a79..b25463f 100644 --- a/UnityMixedCallstack.csproj +++ b/UnityMixedCallstack.csproj @@ -1,10 +1,14 @@  + 14.0 11.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) $(MSBuildProgramFiles32)\Microsoft Visual Studio 14.0\VSSDK\ + v3 + + @@ -65,9 +69,12 @@ - + + Designer + + Designer @@ -89,4 +96,12 @@ + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/packages.config b/packages.config new file mode 100644 index 0000000..6f7355a --- /dev/null +++ b/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/source.extension.vsixmanifest b/source.extension.vsixmanifest index c9a0923..5400376 100644 --- a/source.extension.vsixmanifest +++ b/source.extension.vsixmanifest @@ -1,12 +1,12 @@  - + Unity Mixed Callstack Visual Studio native debugger extension to help debug native applications using Mono. Originally developed by Jb Evain, Updated for Unity by Michael DeRoy and Jonathan Chambers - + @@ -14,4 +14,7 @@ + + + \ No newline at end of file