Exemplo n.º 1
0
        IXamlIlType Resolve(TypeReference reference)
        {
            if (!_typeReferenceCache.TryGetValue(reference, out var rv))
            {
                TypeDefinition resolved = null;
                try
                {
                    resolved = reference.Resolve();
                }
                catch (AssemblyResolutionException)
                {
                }

                if (resolved != null)
                {
                    rv = _typeCache.Get(reference);
                }
                else
                {
                    var key = reference.FullName;
                    if (reference is GenericParameter gp)
                    {
                        key = ((TypeReference)gp.Owner).FullName + "|GenericParameter|" + key;
                    }
                    if (!_unresolvedTypeCache.TryGetValue(key, out rv))
                    {
                        _unresolvedTypeCache[key] =
                            rv = new UnresolvedCecilType(reference);
                    }
                }
                _typeReferenceCache[reference] = rv;
            }
            return(rv);
        }
Exemplo n.º 2
0
        IXamlIlType Resolve(TypeReference reference)
        {
            if (!_typeReferenceCache.TryGetValue(reference, out var rv))
            {
                var resolved = reference.Resolve();

                if (resolved != null)
                {
                    rv = _typeCache.Get(reference);
                }
                else
                {
                    if (!_unresolvedTypeCache.TryGetValue(reference.FullName, out rv))
                    {
                        _unresolvedTypeCache[reference.FullName] =
                            rv = new XamlIlPseudoType("Unresolved:" + reference.FullName);
                    }
                }
                _typeReferenceCache[reference] = rv;
            }
            return(rv);
        }