public static IType GetSourceType(IType type, ITypeResolver typeResolver)
        {
            if (typeResolver.PlatformMetadata.IsNullType((ITypeId)type))
            {
                return(type);
            }
            DesignTypeResult designTypeResult = DesignTypeGenerator.LookupGetDesignTypeResult(type.RuntimeType);

            if (designTypeResult != null && !designTypeResult.IsFailed && designTypeResult.SourceType != type.RuntimeType)
            {
                ITypeResolver typeResolver1 = (ITypeResolver)ProjectXamlContext.FromProjectContext(typeResolver as IProjectContext) ?? typeResolver;
                IType         type1         = typeResolver1.GetType(designTypeResult.SourceType);
                if (!typeResolver1.PlatformMetadata.IsNullType((ITypeId)type1))
                {
                    return(type1);
                }
            }
            return(type);
        }