public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity)
 {
     if (_cache == null)
     {
         return(_innerReferenceResolver.ResolveMissingAssembly(definition, referenceIdentity));
     }
     return(_cache.GetOrAdd(referenceIdentity.ToString(),
                            _ => ImmutableArray.Create(_innerReferenceResolver.ResolveMissingAssembly(definition, referenceIdentity))).FirstOrDefault());
 }
Ejemplo n.º 2
0
        public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity)
        {
            if (MissingReferenceCache.TryGetValue(referenceIdentity.Name, out var result))
            {
                return(result);
            }

            result = DefaultRuntimeResolver.ResolveMissingAssembly(definition, referenceIdentity);
            if (result != null)
            {
                MissingReferenceCache[referenceIdentity.Name] = result;
            }

            return(result);
        }
        public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity)
        {
            if (MissingReferenceCache.ContainsKey(referenceIdentity.Name))
            {
                return(MissingReferenceCache[referenceIdentity.Name]);
            }

            var result = _defaultReferenceResolver.ResolveMissingAssembly(definition, referenceIdentity);

            if (result != null)
            {
                MissingReferenceCache[referenceIdentity.Name] = result;
            }

            return(result);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Resolves a missing assembly reference.
 /// </summary>
 /// <param name="definition">The metadata definition (assembly or module) that declares assembly reference <paramref name="referenceIdentity" /> in its list of dependencies.</param>
 /// <param name="referenceIdentity">Identity of the assembly reference that couldn't be resolved against metadata references explicitly specified to in the compilation.</param>
 /// <returns>
 /// Resolved reference or null if the identity can't be resolved.
 /// </returns>
 public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity)
 {
     return(previousResolver.ResolveMissingAssembly(definition, referenceIdentity));
 }