예제 #1
0
		DbgDotNetValueResult CreateInstanceCore(DmdConstructorInfo ctor, ILValue[] arguments) {
			if (ctor.IsStatic)
				return new DbgDotNetValueResult(PredefinedEvaluationErrorMessages.InternalDebuggerError);

			const DotNetClassHookCallOptions options = DotNetClassHookCallOptions.None;
			foreach (var anyHook in anyClassHooks) {
				var res = anyHook.CreateInstance(options, ctor, arguments);
				if (res != null)
					return new DbgDotNetValueResult(res, valueIsException: false);
			}

			var type = ctor.DeclaringType;
			if (type.IsConstructedGenericType)
				type = type.GetGenericTypeDefinition();
			var typeName = DmdTypeName.Create(type);
			if (classHooks.TryGetValue(typeName, out var hook)) {
				if (DmdWellKnownTypeUtils.TryGetWellKnownType(typeName, out var wellKnownType)) {
					if (type != type.AppDomain.GetWellKnownType(wellKnownType, isOptional: true))
						hook = null;
				}
				if (hook != null) {
					var res = hook.CreateInstance(options, ctor, arguments);
					if (res != null)
						return new DbgDotNetValueResult(res, valueIsException: false);
				}
			}

			if (!canFuncEval)
				throw new InterpreterMessageException(PredefinedEvaluationErrorMessages.FuncEvalDisabled);
			return runtime.CreateInstance(context, frame, ctor, Convert(arguments, ctor.GetMethodSignature().GetParameterTypes()), cancellationToken);
		}
예제 #2
0
 public virtual DbgDotNetValue Call(DotNetClassHookCallOptions options, DbgDotNetValue objValue, DmdMethodBase method, ILValue[] arguments) => null;
예제 #3
0
 public virtual DbgDotNetValue CreateInstance(DotNetClassHookCallOptions options, DmdConstructorInfo ctor, ILValue[] arguments) => null;