Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error : The given key was not present in the dictionary #9

Closed
Zatox opened this issue Apr 12, 2016 · 6 comments
Closed

Error : The given key was not present in the dictionary #9

Zatox opened this issue Apr 12, 2016 · 6 comments
Assignees

Comments

@Zatox
Copy link

Zatox commented Apr 12, 2016

I wanted to eliminate the "data variable" and created a brand new Jira Cloud. I created a few sample projects of different types but I was not able to import any of them. Everytime this error happens a few seconds after pressing "start import". It seems to me that this is more of a TFS issue this time.
I'm again running TFS 2012 on Windows server 2012.

Ian, if you want I can email you the credentials of the custom Jira cloud I created if you would like to try to reproduce.

Here is the exception log :
2016-04-12 17:38:20,405 [10] ERROR JiraToTfs.Presenter.JiraToTfsPresenter - System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary2.get_Item(TKey key) at TicketImporter.TfsPriorityMap.get_Item(String lookUp) at TicketImporter.TfsProject.toWorkItem(Ticket toImport) at TicketImporter.TfsProject.CheckTicket(Ticket toAdd, IFailedTicket& failure) at TicketImporter.TicketImportAgent.StartImport() at JiraToTfs.Presenter.JiraToTfsPresenter.import_DoWork(Object sender, DoWorkEventArgs e) 2016-04-12 17:38:20,405 [1] ERROR JiraToTfs.Presenter.JiraToTfsPresenter - System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary2.get_Item(TKey key)
at TicketImporter.TfsPriorityMap.get_Item(String lookUp)
at TicketImporter.TfsProject.toWorkItem(Ticket toImport)
at TicketImporter.TfsProject.CheckTicket(Ticket toAdd, IFailedTicket& failure)
at TicketImporter.TicketImportAgent.StartImport()
at JiraToTfs.Presenter.JiraToTfsPresenter.import_DoWork(Object sender, DoWorkEventArgs e)

@Zatox
Copy link
Author

Zatox commented Apr 14, 2016

After some serious debugging we found what the issue was. The default mappings don't have a mapping for the priority "medium" and so the error happened when a Jira ticket had that priority. To work around I added the mapping in the xml file that the app generates (same folder). Yours might have more fields than that :
image
After saving this file with this new entry I was able to import fine :)

@KilskyreMan
Copy link
Owner

Cheers Zatox

The tool contains internally a list of "default" jira work item priorities (I couldn't find an easy way of ascertaining this from Jira itself).

Easiest thing to do is update this internal mapping.

Again Zatox, really appreciate this - Thanks. Ian.

Zatox added a commit to Zatox/JiraToTfs that referenced this issue Apr 18, 2016
@Zatox
Copy link
Author

Zatox commented Apr 18, 2016

It seems like that would be a nice place to put it (see commit) but I honestly don't know: I don't have Visual Studio on this computer and it's my first time doing C# and desktop dev so...
image
I'll try to build it tomorrow on the server and see if it gets rid of the error without having to modify the xml file.

@Zatox
Copy link
Author

Zatox commented Apr 18, 2016

What I know though is how one could get the work priorities for a specific Jira. You just need to hit /rest/api/2/priority and it will give it to you in Json format.
For example on the test Jira Cloud I created the output is :
[ { "self": "https://debugtest.atlassian.net/rest/api/2/priority/1", "statusColor": "#d04437", "description": "This problem will block progress.", "iconUrl": "https://debugtest.atlassian.net/images/icons/priorities/highest.svg", "name": "Highest", "id": "1" }, { "self": "https://debugtest.atlassian.net/rest/api/2/priority/2", "statusColor": "#f15C75", "description": "Serious problem that could block progress.", "iconUrl": "https://debugtest.atlassian.net/images/icons/priorities/high.svg", "name": "High", "id": "2" }, { "self": "https://debugtest.atlassian.net/rest/api/2/priority/3", "statusColor": "#f79232", "description": "Has the potential to affect progress.", "iconUrl": "https://debugtest.atlassian.net/images/icons/priorities/medium.svg", "name": "Medium", "id": "3" }, { "self": "https://debugtest.atlassian.net/rest/api/2/priority/4", "statusColor": "#707070", "description": "Minor problem or easily worked around.", "iconUrl": "https://debugtest.atlassian.net/images/icons/priorities/low.svg", "name": "Low", "id": "4" }, { "self": "https://debugtest.atlassian.net/rest/api/2/priority/5", "statusColor": "#999999", "description": "Trivial problem with little or no impact on progress.", "iconUrl": "https://debugtest.atlassian.net/images/icons/priorities/lowest.svg", "name": "Lowest", "id": "5" } ]
And since GitHub won't format that JSon here is one element that won't hurt your eyes :
image
I guess Name and ID is all that's needed.
It seems those priorities vary depending on when the Jira was created and it's very likely that this could be customized.
It would be nice to get those dynamically but that's going to require more knowledge of C# than I have

@KilskyreMan
Copy link
Owner

Thanks again Zatox. Next enhancement will be to dynamically query the priorites from Jira. I'll certainly use what you've found.

Apologies for the long delay in replying, unfortunately my day-job has prevented me from spending as much time as I would like supporting the tool.

@KilskyreMan KilskyreMan self-assigned this Sep 23, 2016
KilskyreMan pushed a commit that referenced this issue Sep 23, 2016
* #12: "There is no Project named X in Source Control".
* #9: "Error: The given key was not present in the dictionary".
See https://github.com/KilskyreMan/JiraToTfs/issues
@KilskyreMan
Copy link
Owner

Hi @Zatox, finally got round to fixing this issue :)
Moving on to next issue you logged.
Thanks for your help again.

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

No branches or pull requests

2 participants