bool InitializeListDebugView(DbgEvaluationInfo evalInfo)
        {
            var info = EnumerableDebugViewHelper.GetListEnumerableMethods(instanceValue.Type, enumerableType);

            if ((object)info.ctor == null)
            {
                return(false);
            }

            DbgDotNetValueResult collTypeResult = default;
            DbgDotNetValueResult toArrayResult  = default;
            bool error = true;

            try {
                var runtime = evalInfo.Runtime.GetDotNetRuntime();

                collTypeResult = runtime.CreateInstance(evalInfo, info.ctor, new[] { instanceValue }, DbgDotNetInvokeOptions.None);
                if (!collTypeResult.IsNormalResult)
                {
                    return(false);
                }
                var expr = valueNodeProviderFactory.GetNewObjectExpression(info.ctor, valueExpression, expectedType);

                toArrayResult = runtime.Call(evalInfo, collTypeResult.Value, info.toArrayMethod, Array.Empty <object>(), DbgDotNetInvokeOptions.None);
                if (toArrayResult.HasError)
                {
                    return(false);
                }
                expr = valueNodeProviderFactory.GetCallExpression(info.toArrayMethod, expr);

                var result = valueNodeProviderFactory.Create(evalInfo, false, toArrayResult.Value.Type, new DbgDotNetValueNodeInfo(toArrayResult.Value, expr), evalOptions);
                if (result.Provider == null)
                {
                    return(false);
                }
                realProvider = result.Provider;
                error        = false;
                return(true);
            }
            finally {
                collTypeResult.Value?.Dispose();
                if (error)
                {
                    toArrayResult.Value?.Dispose();
                }
            }
        }
        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);
        }