You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used WCL to pull the InterwikiMap from Wikipedia. I had the following code, to put a particular item from it in a collection of my own:
if (this.ReferenceSite.InterwikiMap.Contains(namespaceOrWhatever))
{
this.AddWantedInterwiki(this.ReferenceSite.InterwikiMap[namespaceOrWhatever]);
}
That throws the following exception:
Unhandled exception. System.Collections.Generic.KeyNotFoundException: The given key 'Toollabs' was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at WikiClientLibrary.Sites.InterwikiMap.get_Item(String prefix)
at Rwv37.MediaWiki.SiteSetup.Coordinator.AddWantedColonfulWikiPage(WikiPage wikiPage) in C:\Users\bob\Bob\trunk\Dev\DotNet\Rwv37\MediaWiki\Rwv37.MediaWiki.SiteSetup\Coordinator.cs:line 250
at Rwv37.MediaWiki.SiteSetup.Coordinator.AddWantedWikiPage(WikiPage wikiPage) in C:\Users\bob\Bob\trunk\Dev\DotNet\Rwv37\MediaWiki\Rwv37.MediaWiki.SiteSetup\Coordinator.cs:line 215
at Rwv37.MediaWiki.SiteSetup.WantedItemsListRetriever.RetrievePagesAsync() in C:\Users\bob\Bob\trunk\Dev\DotNet\Rwv37\MediaWiki\Rwv37.MediaWiki.SiteSetup\WantedItemsListRetriever.cs:line 49
at Rwv37.MediaWiki.SiteSetup.WantedItemsListRetriever.RetrievePagesAsync() in C:\Users\bob\Bob\trunk\Dev\DotNet\Rwv37\MediaWiki\Rwv37.MediaWiki.SiteSetup\WantedItemsListRetriever.cs:line 49
at Rwv37.MediaWiki.SiteSetup.WantedItemsListRetriever.RetrieveAsync() in C:\Users\bob\Bob\trunk\Dev\DotNet\Rwv37\MediaWiki\Rwv37.MediaWiki.SiteSetup\WantedItemsListRetriever.cs:line 34
at Rwv37.MediaWiki.SiteSetup.Coordinator.GoAsync() in C:\Users\bob\Bob\trunk\Dev\DotNet\Rwv37\MediaWiki\Rwv37.MediaWiki.SiteSetup\Coordinator.cs:line 54
at Rwv37.MediaWiki.SiteSetup.Program.<Main>(String[] args)
Note that the exact same key is used in the calls to Contains and [], so it seems strange that Contains would say the key is in there while at the same time [] would say it is not.
Also note the key is "Toollabs" with a capital T, but Wikipedia's interwiki entries are (I think) all lowercase. So, on a hunch, I tried adding a ToLower call on one (and only one) of them:
if (this.ReferenceSite.InterwikiMap.Contains(namespaceOrWhatever))
{
this.AddWantedInterwiki(this.ReferenceSite.InterwikiMap[namespaceOrWhatever.ToLower()]);
}
And it started working fine. So I think there might be a mismatch between the case-sensitivity-or-not of Contains and [] (which, if correct, would contradict the documentation).
The text was updated successfully, but these errors were encountered:
I used WCL to pull the InterwikiMap from Wikipedia. I had the following code, to put a particular item from it in a collection of my own:
That throws the following exception:
Note that the exact same key is used in the calls to
Contains
and[]
, so it seems strange thatContains
would say the key is in there while at the same time[]
would say it is not.Also note the key is "Toollabs" with a capital T, but Wikipedia's interwiki entries are (I think) all lowercase. So, on a hunch, I tried adding a
ToLower
call on one (and only one) of them:And it started working fine. So I think there might be a mismatch between the case-sensitivity-or-not of
Contains
and[]
(which, if correct, would contradict the documentation).The text was updated successfully, but these errors were encountered: