diff options
Diffstat (limited to 'main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests')
5 files changed, 294 insertions, 146 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/BreakpointsAndSteppingTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/BreakpointsAndSteppingTests.cs index f6140c6ce9..a1d16e178a 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/BreakpointsAndSteppingTests.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/BreakpointsAndSteppingTests.cs @@ -444,6 +444,12 @@ namespace MonoDevelop.Debugger.Tests [Test]
public void DebuggerStepperBoundaryMethod2ProjectAssembliesOnly ()
{
+ IgnoreSoftDebugger ("Fix me");
+ //SDB Ignore: DebuggerStepperBoundary is stupid and pretty much uselss attribute anyway
+ //Problem that we have here is that DebuggerStepperBoundary is handled on IDE side
+ //and if method that has DebuggerStepperBoundary also has DebuggerNonUserCode IDE
+ //is never notified about entering such method since runtime handles DebuggerNonUserCode
+ //hence bug
InitializeTest ();
Session.Options.ProjectAssembliesOnly = true;
AddBreakpoint ("f3a22b38-596a-4463-a562-20b342fdec12");
@@ -874,6 +880,7 @@ namespace MonoDevelop.Debugger.Tests public void CatchPointTest2 ()
{
IgnoreSoftDebugger ("I'm having problem testing this because. There is error nonstop happening in framework about CurrentCulture featching.");
+ IgnoreCorDebugger ("Randomly fails");
InitializeTest ();
AddCatchpoint ("System.Exception", true);
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/ChangeLog b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/ChangeLog deleted file mode 100644 index 920c56f624..0000000000 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/ChangeLog +++ /dev/null @@ -1,44 +0,0 @@ -2010-04-14 Lluis Sanchez Gual <lluis@novell.com> - - * StackFrameTests.cs: - * MdbStackFrameTests.cs: - * SdbEvaluationTests.cs: - * SdbStackFrameTests.cs: - * MdbEvaluationTests.cs: - * MonoDevelop.Debugger.Tests.csproj: Added new test suite for - StackFrame. Reorganized a bit the namespaces. Added tests - for bug #580994. - -2010-04-06 Lluis Sanchez Gual <lluis@novell.com> - - * EvaluationTests.cs: Make some tests work on windows. - -2010-03-17 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.Debugger.Tests.csproj: Merged MD.Projects into - MD.Core, and MD.Projects.Gui, MD.Core.Gui and MD.Components - into MD.Ide. - -2010-03-03 Lluis Sanchez Gual <lluis@novell.com> - - * EvaluationTests.cs: - * MdbEvaluationTests.cs: Fix tests. Formatting rules have - changed. - -2010-03-02 Lluis Sanchez Gual <lluis@novell.com> - - * DebugTests.cs: - * EvaluationTests.cs: - * MdbEvaluationTests.cs: Added boxing tests. Disable - assignment tests for MDB only, they now work with SDB. - -2010-02-16 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.Debugger.Tests.csproj: Flush. - - * DebugTests.cs: Added support for lazy loading of add-ins - -2009-12-16 Lluis Sanchez Gual <lluis@novell.com> - - * MonoDevelop.Debugger.Tests.csproj: Add missing file. - diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/DebugTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/DebugTests.cs index 6b2e752541..fafb2b96c6 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/DebugTests.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/DebugTests.cs @@ -139,7 +139,7 @@ namespace MonoDevelop.Debugger.Tests return; } - Console.WriteLine ("Target Runtime: " + runtime.DisplayRuntimeName + " " + runtime.Version); + Console.WriteLine ("Target Runtime: " + runtime.DisplayRuntimeName + " " + runtime.Version + " " + (IntPtr.Size == 8 ? "64bit" : "32bit")); // main/build/tests FilePath path = Path.GetDirectoryName (GetType ().Assembly.Location); @@ -204,9 +204,16 @@ namespace MonoDevelop.Debugger.Tests }; Session.TargetStopped += (sender, e) => { - Frame = e.Backtrace.GetFrame (0); - lastStoppedPosition = Frame.SourceLocation; - targetStoppedEvent.Set (); + //This can be null in case of ForcedStop + //which is called when exception is thrown + //when Continue & Stepping is executed + if (e.Backtrace != null) { + Frame = e.Backtrace.GetFrame (0); + lastStoppedPosition = Frame.SourceLocation; + targetStoppedEvent.Set (); + } else { + Console.WriteLine ("e.Backtrace is null"); + } }; var targetExited = new ManualResetEvent (false); @@ -215,6 +222,10 @@ namespace MonoDevelop.Debugger.Tests }; Session.Run (dsi, ops); + Session.ExceptionHandler = (ex) => { + Console.WriteLine ("Session.ExceptionHandler:" + Environment.NewLine + ex.ToString ()); + return true; + }; switch (WaitHandle.WaitAny (new WaitHandle[]{ done, targetExited }, 30000)) { case 0: //Breakpoint is hit good... run tests now @@ -295,7 +306,7 @@ namespace MonoDevelop.Debugger.Tests public bool CheckPosition (string guid, int offset = 0, string statement = null, bool silent = false) { - if (!targetStoppedEvent.WaitOne (3000)) { + if (!targetStoppedEvent.WaitOne (6000)) { if (!silent) Assert.Fail ("CheckPosition failure: Target stop timeout"); return false; @@ -427,7 +438,7 @@ namespace MonoDevelop.Debugger.Tests lock (locker) { while (val.IsEvaluating) { - if (!Monitor.Wait (locker, 4000)) + if (!Monitor.Wait (locker, 8000)) throw new Exception ("Timeout while waiting for value evaluation"); } } diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs index 4f06ceae1d..5451a66b67 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs @@ -78,6 +78,12 @@ namespace MonoDevelop.Debugger.Tests return "MonoDevelop"; case "SomeEnum": return "SomeEnum"; + case "IFoo": + return "MonoDevelop.Debugger.Tests.TestApp.IFoo"; + case "IBar": + return "MonoDevelop.Debugger.Tests.TestApp.IBar"; + case "Bo": + return "MonoDevelop.Debugger.Tests.TestApp.Bo"; } return null; } @@ -488,23 +494,34 @@ namespace MonoDevelop.Debugger.Tests val = val.Sync (); } Assert.AreEqual ("\"AbstractImplementation\"", val.Value); + Assert.AreEqual ("string", val.TypeName);
+ + IgnoreCorDebugger("TODO: CorDebugger support explicit interfaces"); + + val = Eval ("((IInterfaceWithMethodA)objWithMethodA).MethodA()"); + if (!AllowTargetInvokes) { + var options = Session.Options.EvaluationOptions.Clone (); + options.AllowTargetInvoke = true; + + Assert.IsTrue (val.IsNotSupported); + val.Refresh (options); + val = val.Sync (); + } + Assert.AreEqual ("\"InterfaceImplementation\"", val.Value); Assert.AreEqual ("string", val.TypeName); - // FIXME: failing on CorDebugger - if (Session is SoftDebuggerSession) { - val = Eval ("true.ToString()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsNotSupported); - val.Refresh (options); - val = val.Sync (); - } + val = Eval ("true.ToString()"); + if (!AllowTargetInvokes) { + var options = Session.Options.EvaluationOptions.Clone (); + options.AllowTargetInvoke = true; - Assert.AreEqual ("\"True\"", val.Value); - Assert.AreEqual ("string", val.TypeName); + Assert.IsTrue (val.IsNotSupported); + val.Refresh (options); + val = val.Sync (); } + + Assert.AreEqual ("\"True\"", val.Value); + Assert.AreEqual ("string", val.TypeName); } [Test] @@ -596,15 +613,15 @@ namespace MonoDevelop.Debugger.Tests ObjectValue val = Eval ("numbers[0]"); Assert.AreEqual ("\"one\"", val.Value); Assert.AreEqual ("string", val.TypeName); - + val = Eval ("numbers[1]"); Assert.AreEqual ("\"two\"", val.Value); Assert.AreEqual ("string", val.TypeName); - + val = Eval ("numbers[2]"); Assert.AreEqual ("\"three\"", val.Value); Assert.AreEqual ("string", val.TypeName); - + val = Eval ("staticString[2]"); if (!AllowTargetInvokes) { var options = Session.Options.EvaluationOptions.Clone (); @@ -616,7 +633,7 @@ namespace MonoDevelop.Debugger.Tests } Assert.AreEqual ("'m'", val.Value); Assert.AreEqual ("char", val.TypeName); - + val = Eval ("alist[0]"); if (!AllowTargetInvokes) { var options = Session.Options.EvaluationOptions.Clone (); @@ -628,7 +645,7 @@ namespace MonoDevelop.Debugger.Tests } Assert.AreEqual ("1", val.Value); Assert.AreEqual ("int", val.TypeName); - + val = Eval ("alist[1]"); if (!AllowTargetInvokes) { var options = Session.Options.EvaluationOptions.Clone (); @@ -640,7 +657,7 @@ namespace MonoDevelop.Debugger.Tests } Assert.AreEqual ("\"two\"", val.Value); Assert.AreEqual ("string", val.TypeName); - + val = Eval ("alist[2]"); if (!AllowTargetInvokes) { var options = Session.Options.EvaluationOptions.Clone (); @@ -652,6 +669,57 @@ namespace MonoDevelop.Debugger.Tests } Assert.AreEqual ("3", val.Value); Assert.AreEqual ("int", val.TypeName); + + IgnoreCorDebugger("TODO: CorDebugger support explicit interfaces"); + + val = Eval ("FooBar[2]"); + Assert.IsTrue (val.IsUnknown); + //We have IFoo and IBar implementation but without typecasting and determening which implementation user wants + //we have to return error/Unknown instead of random implementation(FooBar[2] is not compilable anyway) + val = Eval ("((IFoo)FooBar)[2]"); + if (!AllowTargetInvokes) { + var options = Session.Options.EvaluationOptions.Clone (); + options.AllowTargetInvoke = true; + + Assert.IsTrue (val.IsNotSupported); + val.Refresh (options); + val = val.Sync (); + } + Assert.AreEqual ("int", val.TypeName); + Assert.AreEqual ("2", val.Value); + val = Eval ("((IBar)FooBar)[2]"); + if (!AllowTargetInvokes) { + var options = Session.Options.EvaluationOptions.Clone (); + options.AllowTargetInvoke = true; + + Assert.IsTrue (val.IsNotSupported); + val.Refresh (options); + val = val.Sync (); + } + Assert.AreEqual ("int", val.TypeName); + Assert.AreEqual ("-2", val.Value); + val = Eval ("Bar[3]"); + if (!AllowTargetInvokes) { + var options = Session.Options.EvaluationOptions.Clone (); + options.AllowTargetInvoke = true; + + Assert.IsTrue (val.IsNotSupported); + val.Refresh (options); + val = val.Sync (); + } + Assert.AreEqual ("int", val.TypeName); + Assert.AreEqual ("-3", val.Value); + val = Eval ("Foo[3]"); + if (!AllowTargetInvokes) { + var options = Session.Options.EvaluationOptions.Clone (); + options.AllowTargetInvoke = true; + + Assert.IsTrue (val.IsNotSupported); + val.Refresh (options); + val = val.Sync (); + } + Assert.AreEqual ("int", val.TypeName); + Assert.AreEqual ("3", val.Value); } void CheckValue (string expected, string actual, bool isSimpleProperty) @@ -874,7 +942,73 @@ namespace MonoDevelop.Debugger.Tests val = val.Sync (); } Assert.AreEqual ("3", val.Value); + Assert.AreEqual ("int", val.TypeName);
+ + IgnoreCorDebugger("TODO: CorDebugger support explicit interfaces"); + + val = Eval ("Bar.Prop"); + if (!AllowTargetInvokes) { + var options = Session.Options.EvaluationOptions.Clone (); + options.AllowTargetInvoke = true; + + Assert.IsTrue (val.IsNotSupported); + val.Refresh (options); + val = val.Sync (); + } + Assert.AreEqual ("int", val.TypeName); + Assert.AreEqual ("1", val.Value); + val = Eval ("Foo.Prop"); + if (!AllowTargetInvokes) { + var options = Session.Options.EvaluationOptions.Clone (); + options.AllowTargetInvoke = true; + + Assert.IsTrue (val.IsNotSupported); + val.Refresh (options); + val = val.Sync (); + } + Assert.AreEqual ("int", val.TypeName); + Assert.AreEqual ("2", val.Value); + val = Eval ("FooBar.Prop"); Assert.AreEqual ("int", val.TypeName); + Assert.AreEqual ("3", val.Value); + val = Eval ("((Bo)FooBar).Prop"); + Assert.AreEqual ("int", val.TypeName); + Assert.AreEqual ("4", val.Value); + val = Eval ("FooBar"); + richChildren = val.GetAllChildrenSync (); + Assert.AreEqual ("Prop (MonoDevelop.Debugger.Tests.TestApp.FooBar)", richChildren [0].Name); + Assert.AreEqual ("int", richChildren [0].TypeName); + Assert.AreEqual ("3", richChildren [0].Value); + Assert.AreEqual ("Prop (MonoDevelop.Debugger.Tests.TestApp.Bo)", richChildren [1].Name); + Assert.AreEqual ("int", richChildren [1].TypeName); + Assert.AreEqual ("4", richChildren [1].Value); + if (!AllowTargetInvokes) { + var options = Session.Options.EvaluationOptions.Clone (); + options.AllowTargetInvoke = true; + + Assert.IsTrue (richChildren [2].IsNotSupported); + richChildren [2].Refresh (options); + richChildren [2] = richChildren [2].Sync (); + Assert.IsTrue (richChildren [3].IsNotSupported); + richChildren [3].Refresh (options); + richChildren [3] = richChildren [3].Sync (); + } + //TODO: Include interface names into sorting + if ("Prop (MonoDevelop.Debugger.Tests.TestApp.IFoo)" == richChildren [2].Name) { + Assert.AreEqual ("Prop (MonoDevelop.Debugger.Tests.TestApp.IFoo)", richChildren [2].Name); + Assert.AreEqual ("int", richChildren [2].TypeName); + Assert.AreEqual ("2", richChildren [2].Value); + Assert.AreEqual ("Prop (MonoDevelop.Debugger.Tests.TestApp.IBar)", richChildren [3].Name); + Assert.AreEqual ("int", richChildren [3].TypeName); + Assert.AreEqual ("1", richChildren [3].Value); + } else { + Assert.AreEqual ("Prop (MonoDevelop.Debugger.Tests.TestApp.IFoo)", richChildren [3].Name); + Assert.AreEqual ("int", richChildren [3].TypeName); + Assert.AreEqual ("2", richChildren [3].Value); + Assert.AreEqual ("Prop (MonoDevelop.Debugger.Tests.TestApp.IBar)", richChildren [2].Name); + Assert.AreEqual ("int", richChildren [2].TypeName); + Assert.AreEqual ("1", richChildren [2].Value); + } } [Test] @@ -1520,7 +1654,7 @@ namespace MonoDevelop.Debugger.Tests public void FormatArray () { ObjectValue val; - + val = Eval ("numbers"); Assert.AreEqual ("{string[3]}", val.Value); Assert.AreEqual ("string[]", val.TypeName); @@ -1529,19 +1663,22 @@ namespace MonoDevelop.Debugger.Tests Assert.AreEqual ("{int[2][]}", val.Value); Assert.AreEqual ("int[][]", val.TypeName); + IgnoreCorDebugger ("Randomly fails"); + + val = Eval ("arrayWithLowerBounds"); + Assert.AreEqual ("int[,,]", val.TypeName); + Assert.AreEqual ("{int[3,4,5]}", val.Value); + val = Eval ("numbersMulti"); Assert.AreEqual ("{int[3,4,5]}", val.Value); Assert.AreEqual ("int[,,]", val.TypeName); Assert.IsFalse (val.IsNull); + IgnoreSoftDebugger ("Randomly fails, tracked as Bug 36712"); val = Eval ("nulledByteArray"); Assert.AreEqual ("(null)", val.Value); Assert.AreEqual ("byte[]", val.TypeName); Assert.IsTrue (val.IsNull); - - val = Eval ("arrayWithLowerBounds"); - Assert.AreEqual ("int[,,]", val.TypeName); - Assert.AreEqual ("{int[3,4,5]}", val.Value); } [Test] @@ -1654,21 +1791,6 @@ namespace MonoDevelop.Debugger.Tests { ObjectValue val; - //When fixed put into Inheriting test - val = Eval ("b.TestMethod ()"); - Assert.AreEqual ("2", val.Value); - Assert.AreEqual ("int", val.TypeName); - - //When fixed put into Inheriting test - val = Eval ("b.TestMethod (42)"); - Assert.AreEqual ("44", val.Value); - Assert.AreEqual ("int", val.TypeName); - - //When fixed put into Inheriting test - val = Eval ("base.TestMethodBase ()"); - Assert.AreEqual ("2", val.Value); - Assert.AreEqual ("int", val.TypeName); - val = Eval ("base.TestMethodBase (\"23\")"); Assert.AreEqual ("25", val.Value); Assert.AreEqual ("int", val.TypeName); @@ -1677,10 +1799,6 @@ namespace MonoDevelop.Debugger.Tests Assert.AreEqual ("44", val.Value); Assert.AreEqual ("int", val.TypeName); - val = Eval ("base.TestMethodBaseNotOverrided ()"); - Assert.AreEqual ("1", val.Value); - Assert.AreEqual ("int", val.TypeName); - //When fixed put into TypeReferenceGeneric val = Eval ("Dictionary<string,NestedClass>"); Assert.AreEqual ("System.Collections.Generic.Dictionary<string,MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.NestedClass>", val.Value); @@ -1693,18 +1811,6 @@ namespace MonoDevelop.Debugger.Tests Assert.AreEqual ("<type>", val.TypeName); Assert.AreEqual (ObjectValueFlags.Type, val.Flags & ObjectValueFlags.OriginMask); - //When fixed put into MethodInvoke(failing also on CorDebugger) - val = Eval ("((IInterfaceWithMethodA)objWithMethodA).MethodA()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("\"InterfaceImplementation\"", val.Value); - Assert.AreEqual ("string", val.TypeName); } [Test] @@ -1855,6 +1961,9 @@ namespace MonoDevelop.Debugger.Tests Assert.AreEqual ("43", val.Value); Assert.AreEqual ("int", val.TypeName); + if (soft != null && soft.ProtocolVersion < new Version (2, 40)) + Assert.Ignore ("A newer version of the Mono runtime is required."); + val = Eval ("b.Prop"); if (!AllowTargetInvokes) { var options = Session.Options.EvaluationOptions.Clone (); @@ -1867,7 +1976,7 @@ namespace MonoDevelop.Debugger.Tests Assert.AreEqual ("2", val.Value); Assert.AreEqual ("int", val.TypeName); - val = Eval ("b.PropNoVirt1"); + val = Eval ("((B)b).PropNoVirt1"); if (!AllowTargetInvokes && soft == null) { var options = Session.Options.EvaluationOptions.Clone (); options.AllowTargetInvoke = true; @@ -1879,7 +1988,7 @@ namespace MonoDevelop.Debugger.Tests Assert.AreEqual ("2", val.Value); Assert.AreEqual ("int", val.TypeName); - val = Eval ("b.PropNoVirt2"); + val = Eval ("((B)b).PropNoVirt2"); if (!AllowTargetInvokes && soft == null) { var options = Session.Options.EvaluationOptions.Clone (); options.AllowTargetInvoke = true; @@ -1891,7 +2000,7 @@ namespace MonoDevelop.Debugger.Tests Assert.AreEqual ("2", val.Value); Assert.AreEqual ("int", val.TypeName); - val = Eval ("b.IntField"); + val = Eval ("((B)b).IntField"); Assert.AreEqual ("2", val.Value); Assert.AreEqual ("int", val.TypeName); @@ -1991,9 +2100,6 @@ namespace MonoDevelop.Debugger.Tests Assert.AreEqual ("1", val.Value); Assert.AreEqual ("int", val.TypeName); - if (soft != null && soft.ProtocolVersion < new Version (2, 40)) - Assert.Ignore ("A newer version of the Mono runtime is required."); - val = Eval ("b.TestMethod (\"23\")"); if (!AllowTargetInvokes) { var options = Session.Options.EvaluationOptions.Clone (); @@ -2006,25 +2112,102 @@ namespace MonoDevelop.Debugger.Tests Assert.AreEqual ("25", val.Value); Assert.AreEqual ("int", val.TypeName); - if (Session is SoftDebuggerSession) { - val = Eval ("System.Text.Encoding.UTF8.GetPreamble ()"); - if (!AllowTargetInvokes) { - var options = Session.Options.EvaluationOptions.Clone (); - options.AllowTargetInvoke = true; - - Assert.IsTrue (val.IsNotSupported); - val.Refresh (options); - val = val.Sync (); - } - Assert.AreEqual ("byte[]", val.TypeName); - Assert.AreEqual ("{byte[3]}", val.Value); - var bytes = ((RawValueArray)val.GetRawValue ()).ToArray (); - Assert.AreEqual (239, bytes.GetValue (0)); - Assert.AreEqual (187, bytes.GetValue (1)); - Assert.AreEqual (191, bytes.GetValue (2)); - } else { - Assert.Ignore ("Not working on CorDebugger"); + val = Eval ("base.TestMethodBaseNotOverrided ()"); + if (!AllowTargetInvokes) { + var options = Session.Options.EvaluationOptions.Clone (); + options.AllowTargetInvoke = true; + + Assert.IsTrue (val.IsNotSupported); + val.Refresh (options); + val = val.Sync (); + } + Assert.AreEqual ("1", val.Value); + Assert.AreEqual ("int", val.TypeName); + + val = Eval("base.TestMethodBase ()"); + if (!AllowTargetInvokes)
+ { + var options = Session.Options.EvaluationOptions.Clone(); + options.AllowTargetInvoke = true; + + Assert.IsTrue(val.IsNotSupported); + val.Refresh(options); + val = val.Sync(); } + Assert.AreEqual("2", val.Value); + Assert.AreEqual("int", val.TypeName); + + IgnoreCorDebugger("Not working on CorDebugger"); + + val = Eval("b.PropNoVirt2"); + if (!AllowTargetInvokes)
+ { + var options = Session.Options.EvaluationOptions.Clone(); + options.AllowTargetInvoke = true; + + Assert.IsTrue(val.IsNotSupported); + val.Refresh(options); + val = val.Sync(); + } + Assert.AreEqual("1", val.Value); + Assert.AreEqual("int", val.TypeName); + + val = Eval("b.IntField"); + Assert.AreEqual("1", val.Value); + Assert.AreEqual("int", val.TypeName);
+
+ val = Eval("b.PropNoVirt1"); + if (!AllowTargetInvokes && soft == null)
+ { + var options = Session.Options.EvaluationOptions.Clone(); + options.AllowTargetInvoke = true; + + Assert.IsTrue(val.IsNotSupported); + val.Refresh(options); + val = val.Sync(); + } + Assert.AreEqual("1", val.Value); + Assert.AreEqual("int", val.TypeName); + + val = Eval ("System.Text.Encoding.UTF8.GetPreamble ()"); + if (!AllowTargetInvokes) { + var options = Session.Options.EvaluationOptions.Clone (); + options.AllowTargetInvoke = true; + + Assert.IsTrue (val.IsNotSupported); + val.Refresh (options); + val = val.Sync (); + } + Assert.AreEqual ("byte[]", val.TypeName); + Assert.AreEqual ("{byte[3]}", val.Value); + var bytes = ((RawValueArray)val.GetRawValue ()).ToArray (); + Assert.AreEqual (239, bytes.GetValue (0)); + Assert.AreEqual (187, bytes.GetValue (1)); + Assert.AreEqual (191, bytes.GetValue (2)); + + val = Eval ("b.TestMethod ()"); + if (!AllowTargetInvokes) { + var options = Session.Options.EvaluationOptions.Clone (); + options.AllowTargetInvoke = true; + + Assert.IsTrue (val.IsNotSupported); + val.Refresh (options); + val = val.Sync (); + } + Assert.AreEqual ("1", val.Value); + Assert.AreEqual ("int", val.TypeName); + + val = Eval ("b.TestMethod (42)"); + if (!AllowTargetInvokes) { + var options = Session.Options.EvaluationOptions.Clone (); + options.AllowTargetInvoke = true; + + Assert.IsTrue (val.IsNotSupported); + val.Refresh (options); + val = val.Sync (); + } + Assert.AreEqual ("43", val.Value); + Assert.AreEqual ("int", val.TypeName); } [Test] @@ -2060,14 +2243,11 @@ namespace MonoDevelop.Debugger.Tests Assert.AreEqual ("\"b\"", children [1].Value); } else { // when AllowTargetInvokes is disabled, it also disables debugger proxies - Assert.AreEqual (7, children.Length); + Assert.AreEqual (18, children.Length); Assert.AreEqual ("Comparer", children [0].Name); - Assert.AreEqual ("Count", children [1].Name); - Assert.AreEqual ("Keys", children [2].Name); - Assert.AreEqual ("Values", children [3].Name); - Assert.AreEqual ("Static members", children [4].Name); - Assert.AreEqual ("Non-public members", children [5].Name); - Assert.AreEqual ("IEnumerator", children [6].Name); + Assert.AreEqual ("Static members", children [15].Name); + Assert.AreEqual ("Non-public members", children [16].Name); + Assert.AreEqual ("IEnumerator", children [17].Name); } val = Eval ("stringList"); @@ -2085,12 +2265,11 @@ namespace MonoDevelop.Debugger.Tests Assert.AreEqual ("\"ccc\"", children [2].Value); } else { // when AllowTargetInvokes is disabled, it also disables debugger proxies - Assert.AreEqual (5, children.Length); + Assert.AreEqual (10, children.Length); Assert.AreEqual ("Capacity", children [0].Name); - Assert.AreEqual ("Count", children [1].Name); - Assert.AreEqual ("Static members", children [2].Name); - Assert.AreEqual ("Non-public members", children [3].Name); - Assert.AreEqual ("IEnumerator", children [4].Name); + Assert.AreEqual ("Static members", children [7].Name); + Assert.AreEqual ("Non-public members", children [8].Name); + Assert.AreEqual ("IEnumerator", children [9].Name); } val = Eval ("alist"); diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj index 25bf813d8d..b1212633d0 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj @@ -60,11 +60,6 @@ <Name>MonoDevelop.Core</Name> <Private>False</Private> </ProjectReference> - <ProjectReference Include="..\..\..\core\Mono.Texteditor\Mono.TextEditor.csproj"> - <Project>{A2329308-3751-4DBD-9A75-5F7B8B024625}</Project> - <Name>Mono.TextEditor</Name> - <Private>False</Private> - </ProjectReference> <ProjectReference Include="..\..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj"> <Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project> <Name>MonoDevelop.Ide</Name> |