internal Microsoft.Cci.IFieldReference CreateDataField(byte[] data) { Debug.Assert(!IsFrozen); Microsoft.Cci.ITypeReference type = this.proxyTypes.GetOrAdd((uint)data.Length, size => GetStorageStruct(size)); DebuggerUtilities.CallBeforeAcquiringLock(); //see method comment var block = new MetadataBlock(data); //This object may be accessed concurrently //it is not expected to have a lot of contention here so we will just use lock //if it becomes an issue we can switch to lock-free data structures. lock (this.mappedFields) { var name = GenerateDataFieldName(this.mappedFields.Count); var newField = new MappedField(name, this, type, block); this.mappedFields.Add(newField); return(newField); } }
internal Cci.IFieldReference CreateDataField(byte[] data) { Debug.Assert(!IsFrozen); Cci.ITypeReference type = this.proxyTypes.GetOrAdd((uint)data.Length, size => GetStorageStruct(size)); DebuggerUtilities.CallBeforeAcquiringLock(); //see method comment var block = new MetadataBlock(data); //This object may be accessed concurrently //it is not expected to have a lot of contention here so we will just use lock //if it becomes an issue we can switch to lock-free data structures. lock (this.mappedFields) { var name = GenerateDataFieldName(this.mappedFields.Count); var newField = new MappedField(name, this, type, block); this.mappedFields.Add(newField); return newField; } }