// Token: 0x06001D72 RID: 7538 RVA: 0x00089508 File Offset: 0x00087708
        public override bool Equals(object o)
        {
            if (!(o is AssemblyInfoKey))
            {
                return(false);
            }
            AssemblyInfoKey assemblyInfoKey = (AssemblyInfoKey)o;

            if (assemblyInfoKey.AssemblyFullName == null)
            {
                return(this.AssemblyFullName == null);
            }
            return(assemblyInfoKey.AssemblyFullName.Equals(this.AssemblyFullName));
        }
Esempio n. 2
0
        // assembly maps
        // mapping of ids to Assembly Names and Assembly reference 
        // create an entry for every referenced assembly passed in on compile 
        // in case no tags reference it at compile but do at Load we won't need
        // to be given this information again. 

        internal BamlAssemblyInfoRecord AddAssemblyMap(
            BinaryWriter binaryWriter,
            string assemblyFullName) 
        {
            Debug.Assert(assemblyFullName.Length != 0, "empty assembly"); 
 
            AssemblyInfoKey key = new AssemblyInfoKey();
            key.AssemblyFullName = assemblyFullName; 

            BamlAssemblyInfoRecord bamlAssemblyInfoRecord =
                (BamlAssemblyInfoRecord) GetHashTableData(key);
 
            if (null == bamlAssemblyInfoRecord)
            { 
                bamlAssemblyInfoRecord = new BamlAssemblyInfoRecord(); 
                bamlAssemblyInfoRecord.AssemblyFullName = assemblyFullName;
 
#if PBTCOMPILER
                try
                {
                    if (bamlAssemblyInfoRecord.Assembly == null) 
                    {
                        // Load the assembly so that we can get the Assembly.FullName to store in Baml. 
                        // This will ensure that we are we use the same assembly during compilation and loading. 
                        GetAssemblyFromAssemblyInfo(bamlAssemblyInfoRecord);
                        if (bamlAssemblyInfoRecord.Assembly != null && 
                            bamlAssemblyInfoRecord.Assembly.FullName != assemblyFullName)
                        {
                            // Given name is a partial name for the assembly
 
                            // Add AssemblyInfo for the full name of the assembly and add a cache entry
                            // for the same record against the partial name. Note that there is no need 
                            // to write a Baml record for the partial assembly name 
                            bamlAssemblyInfoRecord = AddAssemblyMap(binaryWriter, bamlAssemblyInfoRecord.Assembly.FullName);
 
                            ObjectHashTable.Add(key, bamlAssemblyInfoRecord);

                            // Records written out the Baml must have a legitimate Assembly ID
                            Debug.Assert(bamlAssemblyInfoRecord.AssemblyId >= 0); 

                            return bamlAssemblyInfoRecord; 
                        } 
                        else
                        { 
                            // Given name is the full name for the assembly. Simply add a cache entry for
                            // the record and write it out to Baml.
                        }
                    } 
                }
                catch(Exception e) 
                { 
                    if (CriticalExceptions.IsCriticalException(e))
                    { 
                       throw;
                    }

                    // It is possible that the we are writing out a record for the very same assembly 
                    // that is being built on compilation. Hence the assembly may not get loaded.
                } 
#endif 

                // review, could be a race condition here. 
                bamlAssemblyInfoRecord.AssemblyId = (short) AssemblyIdMap.Add(bamlAssemblyInfoRecord);

                ObjectHashTable.Add(key,bamlAssemblyInfoRecord);
 
                // Write to BAML
                bamlAssemblyInfoRecord.Write(binaryWriter); 
            } 
            else if (bamlAssemblyInfoRecord.AssemblyId == -1)
            { 
                // This is the case when EnsureAssemblyRecord has cached the AssemblyInfo but hasn't
                // written it out to Baml. This now needs to be written out to Baml.

                Debug.Assert( 
                    bamlAssemblyInfoRecord.Assembly != null &&
                    bamlAssemblyInfoRecord.Assembly.FullName == bamlAssemblyInfoRecord.AssemblyFullName); 
 
                // review, could be a race condition here.
                bamlAssemblyInfoRecord.AssemblyId = (short) AssemblyIdMap.Add(bamlAssemblyInfoRecord); 

                // Write to BAML
                bamlAssemblyInfoRecord.Write(binaryWriter);
            } 

            // Records written out the Baml must have a legitimate Assembly ID 
            Debug.Assert(bamlAssemblyInfoRecord.AssemblyId >= 0); 

            return bamlAssemblyInfoRecord; 
        }