-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Remove Dictionary<K,V>.GetValueOrDefault instance methods and IDictionary<K,V>.GetValueOrDefault extension methods #20892
Comments
API review: Approved in https://github.com/dotnet/corefx/issues/17275#issuecomment-291636863 |
This is fairly easy, while important for 2.0 and interesting as it touches both CoreFX and CoreCLR: Next steps:
|
I'm already in progress :) |
Ah, pity, would be great 'easy' issue - need a couple for new contributors ... |
Give this one to them then :) So that they can get in context with the code -- I was just taking it to clean up my area as fast as possible. Unassigned!! |
Edited your next step comment to add a little bit more detailed for new contributors. |
I will Grab this, It's just deleting ref's and some code, Nothing to Code. Right? |
Hi @Pothulapati thanks for willing to contribute. You'll need to accept an invitation to collaborate so that we can assign it to you. I will assign it to myself meanwhile but now this issue is yours :) feel free to start working on it. How do we send the invitation? @karelz @danmosemsft |
Invitation sent - ping us when you accept @Pothulapati. Thanks @safern, I appreciate you giving it up for the greater good ;-) |
Accepted The Invitation. Looking forward to the Issue. |
@Pothulapati the issue is assigned to you. You can start working on it! If you have any questions please feel free to ask them here. Hope you enjoy contributing! Thanks @karelz |
@safern Forked The Repo, When I try to Build The Repo For the first time, The "Installing dotnet Cli..." is taking a long time and not showing anything. It's because of the slow download speeds of the dotnet cli. Is There any alternative way to install dotnet cli? |
Hi, @Pothulapati did you get it to download? It shouldn't take that long. My guess would be more of like a network speed problem on your side. Before calling |
No,Network speed on my side is fast. I also Tried |
5 hours is definitely not what it would take even with a slow network. I suspect something went wrong. Can you try these two things to try to get us more info on what is going on:
|
@joperezr Now If I Run init-tools.cmd I get the following |
looks like some process is still getting a handle to that zip, is there a way for you to try find that process and kill it, and then clean your repo: |
@joperezr Now,That I have found the process and Killed it. It Just Shows |
@Pothulapati I'm able to download -- where you able to figure it out? After you kill the process and cleaned your repo what does the log file says? |
@jkotas this should be done in CoreRT as well right? |
Yes - since Dictionary was not moved to the shared corelib partition yet. |
Thanks @jkotas I updated the instructions to follow in https://github.com/dotnet/corefx/issues/17917#issuecomment-291749382 so that you don't forget @Pothulapati |
@Pothulapati sorry to hear about your troubles with getting started :( ... this is truly weird and exceptional. We have plenty of contributors and this is the first time we hit similar issue. Please if you, can try another machine, VM, new directory, or anything you can think of -- there is something truly weird going on on your machine and I would like to first get you unblocked ASAP, and then deep dive into what happened and why, so that we can avoid such bad experience in future for new contributors. Thank you for you patience and sorry for that! |
@safern After killing the process and running the clean.cmd I still get "Installing dotnet cli..." in the clean cmd(and it doesn't respond too).Sorry For Bugging you. |
@karelz I tried in another machine but it shows the same thing but when I run it in an Azure VM, It Works Fine. |
@dotnet/fxdc quick review ask: We are pulling out First proposed API (Remove IReadOnlyDictionary extension method)partial class CollectionExtensions
{
public static bool TryAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue value)
public static bool Remove<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, out TValue value)
public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key);
public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue);
- public static TValue GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key);
- public static TValue GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue);
} Keep Second OptionDelete all partial class CollectionExtensions
{
public static bool TryAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue value)
public static bool Remove<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, out TValue value)
- public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key);
- public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue);
- public static TValue GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key);
- public static TValue GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue);
} See details: in today's code If we have to API reviewers' upvotes, let's go ahead. If there are questions, let's bring it to proper API review on Tuesday. |
Thanks @karelz for bringing that quick API Proposal, hopefully we can get an answer soon so that we can solve the ambiguity. |
While we are here, people will run into the exact same situation with all the classes in the framework which implement |
@karelz did we get any update from the review group? This seems to be a breaking change we would be introducing, it can be workaround from our costumers but not ideal. cc: @terrajobst |
Our having added this extension to both IDictionary and IReadOnlyDictionary causes a problem for any type that implements both interfaces, something we expect to be common. We shouldn't add a specific overload for every one of our own types that implements both, and we can't do so for types we don't own (any 3rd party collection that implements both). I suggest the right solution is to remove either the extensions on IDictionary or the extensions on IReadOnlyDictionary, leaving just one of them. |
I'd hope to encourage wider implementation of |
I vaguely remember the discussions about We didn't review it, because I didn't mark it for API review :( ... we may need to postpone it for next Tuesday. |
@karelz Are you referring to this comment: https://github.com/dotnet/corefx/issues/3482#issuecomment-263007579? |
Yep, thanks @svick! I thought it was you doing the research, just wasn't 100% sure. And kudos for monitoring entire CoreFX (I don't understand how you handle the volume :)). |
So then we should mark this as api-ready-for-review and update the proposal to be deleting one of the extensions methods. |
I guess something like that ... |
I've updated the API proposal, so I'm marking it ready for review: https://github.com/dotnet/corefx/issues/17917#issuecomment-296093667 |
We believe the best course is to remove the overloads that take
partial class CollectionExtensions
{
public static bool TryAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue value)
public static bool Remove<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, out TValue value)
- public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key);
- public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue);
public static TValue GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key);
public static TValue GetValueOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue);
} |
@Pothulapati could you please follow up with this issue? Next steps:
Could you do this on a PR please? P.S: You are still missing to remove |
@safern In The CoreClr Repo,If I remove the GetValueOrDefault Methods from the Dictionary,I Get The Following Error
It's Because |
(@Pothulapati That would be easier to read if fenced with |
Maybe we should move CollectionExtensions implementation to S.Private.Corelib because it seems like CoreRT and CoreCLR implementations use |
I would not move CollectionExtensions down. We should just update them to not use this helper. |
@Pothulapati could you just update |
It should be replaced by ContainsKey in most places - it should result in tiny bit faster and smaller code. |
Fixed with 3 PRs: dotnet/corefx#19247, dotnet/corert#3515, dotnet/coreclr#11388 Thanks @Pothulapati for your contribution. |
Thank you @Pothulapati! |
Very happy to hear you liked it @Pothulapati. If you're interested, please help us make the new contributor docs better here: https://github.com/dotnet/corefx/wiki/New-contributor-Docs#main-page-section-content (writeable by anyone for easier collaboration, hacking on it with @haralabidis for last week) You might also find this useful & interesting: http://rion.io/2017/04/28/contributing-to-net-for-dummies/ |
IDictionary<TKey,TValue>
already has:As extension methods in
CollectionExtensions
.In this discussion: #20684 we've decided to remove this instance methods, see: https://github.com/dotnet/corefx/issues/17275#issuecomment-291636863
cc: @danmosemsft @ianhays
The text was updated successfully, but these errors were encountered: