/// <exception cref="ImageFormatLimitationException">The remaining space on the heap is too small to fit the string.</exception> public UserStringHandle GetOrAddUserString(string str) { int offset; if (!_userStrings.TryGetValue(str, out offset)) { Debug.Assert(!_streamsAreComplete); offset = GetNewUserStringHeapOffset(str.Length); _userStrings.Add(str, offset); _userStringWriter.WriteUserString(str); } return(MetadataTokens.UserStringHandle(offset)); }