if (!listening) {
var pi = new Diag.ProcessStartInfo ();
- if (runtime != null)
+ if (runtime != null) {
pi.FileName = runtime;
- else
+ } else if (Path.DirectorySeparatorChar == '\\') {
+ string processExe = Diag.Process.GetCurrentProcess ().MainModule.FileName;
+ if (processExe != null) {
+ string fileName = Path.GetFileName (processExe);
+ if (fileName.StartsWith ("mono") && fileName.EndsWith (".exe"))
+ pi.FileName = processExe;
+ }
+ }
+ if (string.IsNullOrEmpty (pi.FileName))
pi.FileName = "mono";
pi.Arguments = String.Join (" ", args);
vm = VirtualMachineManager.Launch (pi, new LaunchOptions { AgentArgs = agent_args });
AssertValue ("T", s ["s"]);
AssertValue (45, s ["k"]);
+ // Test SetThis ()
+ s ["i"] = vm.CreateValue (55);
+ frame.SetThis (s);
+ obj = frame.GetThis ();
+ Assert.IsTrue (obj is StructMirror);
+ s = obj as StructMirror;
+ AssertValue (55, s ["i"]);
+ AssertValue ("T", s ["s"]);
+ AssertValue (45, s ["k"]);
+
// this on static vtype methods
e = run_until ("vtypes3");
e = step_until (e.Thread, "static_foo");
Assert.Fail ();
}
}
+
+ var scopes = frame.Method.GetScopes ();
+ Assert.AreEqual (2, scopes.Length);
}
Event step_once () {
Assert.AreEqual ("Exception", ex.Exception.Type.Name);
}
-#if NET_4_5
// out argument
m = t.GetMethod ("invoke_out");
var out_task = this_obj.InvokeMethodAsyncWithResult (e.Thread, m, new Value [] { vm.CreateValue (1), vm.CreateValue (null) }, InvokeOptions.ReturnOutArgs);
out_task = this_obj.InvokeMethodAsyncWithResult (e.Thread, m, new Value [] { vm.CreateValue (1), vm.CreateValue (null) });
out_args = out_task.Result.OutArgs;
Assert.IsNull (out_args);
-#endif
// newobj
m = t.GetMethod (".ctor");
v = t.InvokeMethod (e.Thread, m, new Value [] { vm.RootDomain.CreateString ("ABC") }, InvokeOptions.Virtual);
AssertValue ("ABC", v);
-#if NET_4_5
// instance
m = t.GetMethod ("invoke_pass_ref");
var task = this_obj.InvokeMethodAsync (e.Thread, m, new Value [] { vm.RootDomain.CreateString ("ABC") });
m = t.GetMethod ("invoke_static_pass_ref");
task = t.InvokeMethodAsync (e.Thread, m, new Value [] { vm.RootDomain.CreateString ("ABC") });
AssertValue ("ABC", task.Result);
-#endif
// Argument checking
v = t.InvokeMethod (e.Thread, m, new Value [] { vm.CreateValue (1) });
AssertValue (1, (v as StructMirror)["i"]);
-#if NET_4_5
// Invoke a method which changes state
s = frame.GetArgument (1) as StructMirror;
t = s.Type;
m = vm.RootDomain.Corlib.GetType ("System.Object").GetMethod ("ToString");
v = s.InvokeMethod (e.Thread, m, null, InvokeOptions.Virtual);
AssertValue ("42", v);
-#endif
}
[Test]
vm = null;
}
-#if NET_4_5
[Test]
public void UnhandledExceptionUserCode () {
vm.Detach ();
vm.Exit (0);
vm = null;
}
-#endif
[Test]
public void GCWhileSuspended () {