From c049f307f13a923210b58fc04925d6cb190d6261 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 5 May 2014 17:19:10 -0400 Subject: [PATCH] [Mono.Debugger.Soft] Modified TypeMirror.NewInstance() to check that the method is a .ctor --- .../Mono.Debugger.Soft/TypeMirror.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs index e7baa44fae0..de4e7e05b6f 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs @@ -816,10 +816,22 @@ namespace Mono.Debugger.Soft #endif public Value NewInstance (ThreadMirror thread, MethodMirror method, IList 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 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); } -- 2.25.1