[Mono.Debugger.Soft] Modified TypeMirror.NewInstance() to check that the method is...
authorJeffrey Stedfast <jeff@xamarin.com>
Mon, 5 May 2014 21:19:10 +0000 (17:19 -0400)
committerJeffrey Stedfast <jeff@xamarin.com>
Mon, 5 May 2014 21:20:07 +0000 (17:20 -0400)
mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs

index e7baa44fae09943942b1353621458bebe76374b9..de4e7e05b6f1eb1e48b58983c8a7defc9d5bf0d3 100644 (file)
@@ -816,10 +816,22 @@ namespace Mono.Debugger.Soft
 #endif
 
                public Value NewInstance (ThreadMirror thread, MethodMirror method, IList<Value> arguments) {
+                       if (method == null)
+                               throw new ArgumentNullException ("method");
+
+                       if (!method.IsConstructor)
+                               throw new ArgumentException ("The method must be a constructor.", "method");
+
                        return ObjectMirror.InvokeMethod (vm, thread, method, null, arguments, InvokeOptions.None);
                }                       
 
                public Value NewInstance (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options) {
+                       if (method == null)
+                               throw new ArgumentNullException ("method");
+
+                       if (!method.IsConstructor)
+                               throw new ArgumentException ("The method must be a constructor.", "method");
+
                        return ObjectMirror.InvokeMethod (vm, thread, method, null, arguments, options);
                }