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); }
public virtual DbgDotNetValue Call(DotNetClassHookCallOptions options, DbgDotNetValue objValue, DmdMethodBase method, ILValue[] arguments) => null;
public virtual DbgDotNetValue CreateInstance(DotNetClassHookCallOptions options, DmdConstructorInfo ctor, ILValue[] arguments) => null;