protected override string InitializeCore(DbgEvaluationInfo evalInfo) { if ((evalOptions & DbgValueNodeEvaluationOptions.NoFuncEval) != 0) { return(PredefinedEvaluationErrorMessages.FuncEvalDisabled); } var proxyCtor = DynamicMetaObjectProviderDebugViewHelper.GetDynamicMetaObjectProviderDebugViewConstructor(appDomain); if ((object)proxyCtor == null) { var loadState = appDomain.GetOrCreateData <ForceLoadAssemblyState>(); if (Interlocked.Exchange(ref loadState.Counter, 1) == 0) { var loader = new ReflectionAssemblyLoader(evalInfo, appDomain); if (loader.TryLoadAssembly(GetRequiredAssemblyFullName(evalInfo.Runtime))) { proxyCtor = DynamicMetaObjectProviderDebugViewHelper.GetDynamicMetaObjectProviderDebugViewConstructor(appDomain); } } if ((object)proxyCtor == null) { var asmFilename = GetRequiredAssemblyFilename(evalInfo.Runtime); var asm = appDomain.GetAssembly(Path.GetFileNameWithoutExtension(asmFilename)); if (asm == null) { return(string.Format(dnSpy_Roslyn_Resources.DynamicViewAssemblyNotLoaded, asmFilename)); } return(string.Format(dnSpy_Roslyn_Resources.TypeDoesNotExistInAssembly, DynamicMetaObjectProviderDebugViewHelper.GetDebugViewTypeDisplayName(), asmFilename)); } } var runtime = evalInfo.Runtime.GetDotNetRuntime(); var proxyTypeResult = runtime.CreateInstance(evalInfo, proxyCtor, new[] { instanceValue }, DbgDotNetInvokeOptions.None); if (proxyTypeResult.HasError) { return(proxyTypeResult.ErrorMessage); } dynamicViewProxyExpression = valueNodeProviderFactory.GetNewObjectExpression(proxyCtor, valueExpression, expectedType); getDynamicViewValue = proxyTypeResult.Value; valueNodeProviderFactory.GetMemberCollections(getDynamicViewValue.Type, evalOptions, out membersCollection, out _); return(null); }
string InitializeEnumerableDebugView(DbgEvaluationInfo evalInfo) { var proxyCtor = EnumerableDebugViewHelper.GetEnumerableDebugViewConstructor(enumerableType); if ((object)proxyCtor == null) { var loadState = enumerableType.AppDomain.GetOrCreateData <ForceLoadAssemblyState>(); if (Interlocked.Exchange(ref loadState.Counter, 1) == 0) { var loader = new ReflectionAssemblyLoader(evalInfo, enumerableType.AppDomain); if (loader.TryLoadAssembly(GetRequiredAssemblyFullName(evalInfo.Runtime))) { proxyCtor = EnumerableDebugViewHelper.GetEnumerableDebugViewConstructor(enumerableType); } } if ((object)proxyCtor == null) { var asmFilename = GetRequiredAssemblyFilename(evalInfo.Runtime); var asm = enumerableType.AppDomain.GetAssembly(Path.GetFileNameWithoutExtension(asmFilename)); if (asm == null) { return(string.Format(dnSpy_Roslyn_Resources.SystemCoreDllNotLoaded, asmFilename)); } return(string.Format(dnSpy_Roslyn_Resources.TypeDoesNotExistInAssembly, EnumerableDebugViewHelper.GetDebugViewTypeDisplayName(enumerableType), asmFilename)); } } var runtime = evalInfo.Runtime.GetDotNetRuntime(); var proxyTypeResult = runtime.CreateInstance(evalInfo, proxyCtor, new[] { instanceValue }, DbgDotNetInvokeOptions.None); if (proxyTypeResult.HasError) { return(proxyTypeResult.ErrorMessage); } resultsViewProxyExpression = valueNodeProviderFactory.GetNewObjectExpression(proxyCtor, valueExpression, expectedType); getResultsViewValue = proxyTypeResult.Value; valueNodeProviderFactory.GetMemberCollections(getResultsViewValue.Type, evalOptions, out membersCollection, out _); return(null); }