Microsoft.Cci.MetadataHostEnvironment.LoadAssembly C# (CSharp) Method

LoadAssembly() public method

The assembly that matches the given reference, or a dummy assembly if no matching assembly can be found.
public LoadAssembly ( Microsoft.Cci.AssemblyIdentity assemblyIdentity ) : IAssembly
assemblyIdentity Microsoft.Cci.AssemblyIdentity
return IAssembly
    public virtual IAssembly LoadAssembly(AssemblyIdentity assemblyIdentity) {
      IUnit/*?*/ unit;
      lock (GlobalLock.LockingObject) {
        this.unitCache.TryGetValue(assemblyIdentity, out unit);
      }
      IAssembly/*?*/ result;
      if (unit != null)
        result = unit as IAssembly;
      else {
        if (string.IsNullOrEmpty(assemblyIdentity.Location) || string.Equals(assemblyIdentity.Location, "unknown://location", StringComparison.OrdinalIgnoreCase)) {
          result = Dummy.Assembly;
          lock (GlobalLock.LockingObject) {
            this.unitCache.Add(assemblyIdentity, result);
          }
        } else {
          unit = this.LoadUnitFrom(assemblyIdentity.Location);
          result = unit as IAssembly;
          if (result != null && this.UnifyAssembly(result).Equals(assemblyIdentity))
            lock (GlobalLock.LockingObject) {
              this.unitCache[assemblyIdentity] = result;
              this.coreIdentities.Add(result.CoreAssemblySymbolicIdentity);
            }
        }
      }
      if (result == null) result = Dummy.Assembly;
      return result;
    }