From 23965e602a254d5e0d5aee2262ea94a4b39bfc5b Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Tue, 19 Jan 2021 15:04:38 +0000 Subject: [PATCH 1/2] [Tests] Add NuGet.Config file for .NET Core tests Clear out any other package sources defined on the local machine when restoring the projects for the debugger tests. --- .../NuGet.config | 6 ++++++ .../MonoDevelop.Debugger.Tests.TestAppCore/NuGet.config | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 UnitTests/MonoDevelop.Debugger.Tests.NonUserCodeTestLibCore/NuGet.config create mode 100644 UnitTests/MonoDevelop.Debugger.Tests.TestAppCore/NuGet.config diff --git a/UnitTests/MonoDevelop.Debugger.Tests.NonUserCodeTestLibCore/NuGet.config b/UnitTests/MonoDevelop.Debugger.Tests.NonUserCodeTestLibCore/NuGet.config new file mode 100644 index 000000000..167b985e8 --- /dev/null +++ b/UnitTests/MonoDevelop.Debugger.Tests.NonUserCodeTestLibCore/NuGet.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/UnitTests/MonoDevelop.Debugger.Tests.TestAppCore/NuGet.config b/UnitTests/MonoDevelop.Debugger.Tests.TestAppCore/NuGet.config new file mode 100644 index 000000000..167b985e8 --- /dev/null +++ b/UnitTests/MonoDevelop.Debugger.Tests.TestAppCore/NuGet.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From c14882888bcd359924a0ccfe3951d561ed316e81 Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Tue, 19 Jan 2021 15:24:25 +0000 Subject: [PATCH 2/2] [Tests] Fix .NET Core tests due to use of external code changes .NET Core debugger is now passed includeAll set to true when requesting stack trace information to make it consistent with Visual Studio on Windows. This affects the breakpoint and stepping tests when checking external code in the stack frames. --- .../Shared/BreakpointsAndSteppingTests.cs | 69 +++++-------------- 1 file changed, 18 insertions(+), 51 deletions(-) diff --git a/UnitTests/Mono.Debugging.Tests/Shared/BreakpointsAndSteppingTests.cs b/UnitTests/Mono.Debugging.Tests/Shared/BreakpointsAndSteppingTests.cs index 4c4c0623c..3a1c76434 100644 --- a/UnitTests/Mono.Debugging.Tests/Shared/BreakpointsAndSteppingTests.cs +++ b/UnitTests/Mono.Debugging.Tests/Shared/BreakpointsAndSteppingTests.cs @@ -266,10 +266,7 @@ public void DebuggerNonUserCodeMethod () //entering EmptyTestMethod StepIn ("49326780-f51b-4510-a52c-03e7af442dda"); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode); - if (IsVsDebugger) - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); - else - Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); + Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden); @@ -313,10 +310,7 @@ public void DebuggerNonUserCodeMethod () //entering EmptyTestMethod StepIn ("49326780-f51b-4510-a52c-03e7af442dda"); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode); - if (IsVsDebugger) - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); - else - Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); + Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden); @@ -340,10 +334,7 @@ public void DebuggerNonUserCodeMethod () //entering EmptyTestMethod StepIn ("49326780-f51b-4510-a52c-03e7af442dda"); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode); - if (IsVsDebugger) - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); - else - Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); + Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden); @@ -367,10 +358,7 @@ public void DebuggerNonUserCodeMethod () //entering EmptyTestMethod StepIn ("49326780-f51b-4510-a52c-03e7af442dda"); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode); - if (IsVsDebugger) - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); - else - Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); + Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden); @@ -394,10 +382,7 @@ public void DebuggerNonUserCodeMethod () //entering EmptyTestMethod StepIn ("49326780-f51b-4510-a52c-03e7af442dda"); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode); - if (IsVsDebugger) - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); - else - Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); + Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden); @@ -434,50 +419,35 @@ public void DebuggerNonUserCodeMethod () CheckPosition ("02757896-0e76-40b8-8235-d09d2110da78"); StepIn ("49326780-f51b-4510-a52c-03e7af442dda"); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode); - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); + Assert.AreEqual (!IsVsDebugger, Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1); StepIn ("02757896-0e76-40b8-8235-d09d2110da78"); StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 1); StepIn ("49326780-f51b-4510-a52c-03e7af442dda"); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode); - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); - if (IsVsDebugger) - Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); - else - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (3).IsExternalCode); - if (IsVsDebugger) - Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (4).IsExternalCode); - else - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (4).IsExternalCode); + Assert.AreEqual (!IsVsDebugger, Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); + Assert.AreEqual (!IsVsDebugger, Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); + Assert.AreEqual (!IsVsDebugger, Session.ActiveThread.Backtrace.GetFrame (3).IsExternalCode); + Assert.AreEqual (!IsVsDebugger, Session.ActiveThread.Backtrace.GetFrame (4).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (5).IsExternalCode); StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1); StepIn ("49326780-f51b-4510-a52c-03e7af442dda"); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode); - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); - if (IsVsDebugger) - Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); - else - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (3).IsExternalCode); + Assert.AreEqual (!IsVsDebugger, Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); + Assert.AreEqual (!IsVsDebugger, Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); + Assert.AreEqual (!IsVsDebugger, Session.ActiveThread.Backtrace.GetFrame (3).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (4).IsExternalCode); StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1); StepIn ("49326780-f51b-4510-a52c-03e7af442dda"); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode); - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); - if (IsVsDebugger) - Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); - else - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); - if (IsVsDebugger) - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (3).IsExternalCode); - else - Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (3).IsExternalCode); + Assert.AreEqual (!IsVsDebugger, Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); + Assert.AreEqual (!IsVsDebugger, Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); + Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (3).IsExternalCode); StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1); StepIn ("49326780-f51b-4510-a52c-03e7af442dda"); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode); - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); + Assert.AreEqual (!IsVsDebugger, Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); StepIn ("49326780-f51b-4510-a52c-03e7af442dda", 1); StepIn ("02757896-0e76-40b8-8235-d09d2110da78", 1); @@ -553,10 +523,7 @@ public void DebuggerStepThroughMethod () CheckPosition ("707ccd6c-3464-4700-8487-a83c948aa0c3"); StepIn ("49326780-f51b-4510-a52c-03e7af442dda"); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsExternalCode); - if (IsVsDebugger) - Assert.IsTrue (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); - else - Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); + Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (2).IsExternalCode); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (0).IsDebuggerHidden); Assert.IsFalse (Session.ActiveThread.Backtrace.GetFrame (1).IsDebuggerHidden);