Questions tagged [keynotfoundexception]

For issues relating to the .NET KeyNotFoundException.

The KeyNotFoundException is an Exception of the .NET that is thrown when the key specified for accessing an element in a collection does not match any key in the collection.

KeyNotFoundException uses the HRESULT COR_E_KEYNOTFOUND, which has the value 0x80131577.

44 questions
0
votes
1 answer

C#: KeyNotFoundException: The given key was not present in the dictionary

foreach (KeyValuePair kvp in propertyDict) { Debug.Log(kvp.Key.GetType()+" : "+ kvp.Key+ " "+ mainText.text.GetType()+ " "+ mainText.text); } slider.value = propertyDict[mainText.text].GetSpeed(); 5 items get printed…
MrRobot9
  • 2,402
  • 4
  • 31
  • 68
0
votes
0 answers

Referencing Xamarin Application Resources from Code

I have an app.xaml that looks like this:
user3352488
  • 281
  • 3
  • 15
0
votes
2 answers

VB.net 'System.Collections.Generic.KeyNotFoundException' exception

Here is my code: Imports System.IO Imports MySql.Data.MySqlClient Public Class F_login Dim strServer As String = "localhost" Dim strDB As String = "lab_utilization" Dim strUser As String = "root" Dim strPw As String = "" Dim…
0
votes
1 answer

Here Maps {"error":"Unauthorized","error_description":"ApiKey invalid. ApiKey not found."} Documentation Error

https://developer.here.com/documentation/maps/dev_guide/topics/routing.html {"error":"Unauthorized","error_description":"ApiKey invalid. ApiKey not found."} I am using here maps api for routing and it's showing api key error key not found when i am…
0
votes
1 answer

"Key not present in dictionary" when I look at the contents, the key IS there

I'm trying to make a map using "Graphnodes" and coordinates where it would form a grid. I'm doing this first filling every coordinate in with a graphnode, and then going back through and connecting them all up. When I'm going through it tells me…
Kijilas
  • 33
  • 6
0
votes
0 answers

VB.NET KeyNotFoundException from String()

I'm updating some old code to use SortedList(Of String, Integer) objects and the lowest level function has all of a sudden begun throwing errors. The "KeyNotFoundException" error is thrown as I begin enumerating through the parsed line. Code as…
tbm0115
  • 410
  • 11
  • 21
0
votes
0 answers

c# ListViewItem gets stuck in edit mode when AfterLabelEdit event fires

As the title says, when the AfterLabelEdit fires, the ListViewItem gets stuck in edit mode even if I press return or click on empty space. The error: A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in …
betaFlux
  • 183
  • 1
  • 3
  • 12
0
votes
1 answer

workitem.open() KeyNotFoundException TFS 2013

I'm stuck with this exception "The given key was not present in the dictionary" which indicates that some value was not found in the dictionary, but the strange thing is I'm not using any dictionary, I guess it is some internal code of the TFS API…
0
votes
3 answers

C# Dictionary giving a KeyNotFoundException, not sure why

I'm an amateur programmer, and this seems like a simple problem to fix, but I just can't figure out how. Below is C# code that isn't acting like I want it to. I expect for this to return 3, yet instead throws a KeyNotFoundException. The Lists are…
vlts
  • 3
  • 1
0
votes
1 answer

Multi level dictionary error in c#

Im using the following code to make JSON FilterModel f = new FilterModel(); f.FilterName = "EducationLevel"; f.filterValue = new List(); f.filterValue.Add("BE"); f.GroupName="Education"; …
backtrack
  • 7,996
  • 5
  • 52
  • 99
0
votes
2 answers

C# exception: Key is not present in the dictionary

I got a little problem. Sometimes, when I try to call the following code, the remove methods throw an exception with the message "the key is not present in the dictionary". private Dictionary dIPHostTable; private…
Emiswelt
  • 3,909
  • 1
  • 38
  • 56
0
votes
2 answers

KeyNotFoundException when a Key with the requested value exists in VB.NET ASP.NET 2.0 Dictionary

The ValueList variable is defined as Dictionary(Of String, String) The watch values captured show the data (tmpData) has a value of "1". The ValueList is defined such that the replacement value for "1" is "Project Resource" as can be seen form the…
Jim Birchall
  • 350
  • 2
  • 3
  • 8
-1
votes
2 answers

MS Dynamics 365 C# audit history KeyNotFoundException

I am trying to pull the audit history of a specific account as demonstrated by an example here: I specifically need to pull all the results for the Changed Field called Credit Limit. In order to do this, I have the following code in C#: using…
Sweepster
  • 1,829
  • 4
  • 27
  • 66
-1
votes
3 answers

How can this piece of code throw a KeyNotFoundException while the dictionary is readonly and never updated!? Most of the time it works fine

Edit: most of the time it works fine the error is exceptional. On the line where this method is called the error report says it threw a KeyNotFoundException" im mapping an enum to a string (!im not updating the dictionary in any way its filled while…
Viking
  • 465
  • 3
  • 15
1 2
3