Skip to content

Conversation

@prasanthlouis
Copy link
Contributor

@prasanthlouis prasanthlouis commented Jul 8, 2019

I think it'd be more clear if it was explained that using the Add method to add to an already existing key fails "silently" rather than throwing an exception, or something along those lines. When I read the word "fails", I was expecting it was going throw an exception just like how dictionaries work. What do you guys think? If not "silently", then maybe something along those lines.

Summary

Describe your changes here.

Fixes #Issue_Number (if available)

I think it'd be more clear if it was explained that using the Add method to add to an already existing key fails "silently" rather than throwing an exception, or something along those lines. I was expecting "fails" was going throw an exception just like how dictionaries work. What do you guys think?
@prasanthlouis prasanthlouis requested a review from scottaddie as a code owner July 8, 2019 20:19
@prasanthlouis prasanthlouis changed the title Update Cache.xml Updating Cache.Add documentation - Fails silently if key already exists rather than throwing an exception Jul 8, 2019
@mairaw mairaw added this to the July 2019 milestone Jul 24, 2019
@Thraka
Copy link
Contributor

Thraka commented Jul 26, 2019

This looks good to me. However, I can't seem to find the source code for the CacheStoreProvider type (which is what is implementing the Add method) on Reference Source to validate this indeed behaves this way...

@mairaw
Copy link
Contributor

mairaw commented Jul 26, 2019

Wouldn't be this the implementation of this method?
https://referencesource.microsoft.com/#System.Web/Cache/cache.cs,26152879ad8a322a

@mairaw
Copy link
Contributor

mairaw commented Jul 26, 2019

And for CacheStoreProvider, that's available only through the internal version:
http://index/?query=cache.add&rightProject=System.Web&file=Cache%5CCacheStoreProvider.cs&rightSymbol=kvw1ervp0adr

@Thraka
Copy link
Contributor

Thraka commented Jul 26, 2019

Yes it was, but it's just forwards to ObjectCache.Add which is a variable of an abstract base class. Anyhoo I tracked it down and verified it does just exit and doesn't throw anything.

Great catch @prasanthlouis

Thanks!

@Thraka Thraka merged commit bd0d06b into dotnet:master Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants