internal static DynamicViewExpansion CreateExpansion(DkmInspectionContext inspectionContext, DkmClrValue value, ResultProvider resultProvider) { if (value.IsError() || value.IsNull || value.HasExceptionThrown()) { return null; } var type = value.Type.GetLmrType(); if (!(type.IsComObject() || type.IsIDynamicMetaObjectProvider())) { return null; } var proxyValue = value.InstantiateDynamicViewProxy(inspectionContext); Debug.Assert((proxyValue == null) || (!proxyValue.IsNull && !proxyValue.IsError() && !proxyValue.HasExceptionThrown())); // InstantiateDynamicViewProxy may return null (if required assembly is missing, for instance). if (proxyValue == null) { return null; } // Expansion is based on the 'DynamicMetaObjectProviderDebugView.Items' property. var proxyType = proxyValue.Type; var itemsMemberExpansion = RootHiddenExpansion.CreateExpansion( proxyType.GetMemberByName("Items"), DynamicFlagsMap.Create(new TypeAndCustomInfo(proxyType))); return new DynamicViewExpansion(proxyValue, itemsMemberExpansion); }