字典中没有给定的密钥 [英] the given key was not present in the dictionary

查看:126
本文介绍了字典中没有给定的密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从VS 2013上的C#代码生成序列图。 它是一个web api应用程序,但是当我点击生成序列图时会出现一条消息:给定的密钥不在字典中。我不知道这意味着什么....帮助!!!

解决方案

Hi Mishu175,


欢迎来到MSDN论坛。


请参阅错误消息,请尝试使用以下内容来解决此问题:


  1. 在您点击生成序列图之前,请重建解决方案并确保成功重建。
  2. 之后然后,在要从中生成图表的方法中单击鼠标右键。 (确保在方法中生成图表)
  3. 始终消息"不存在的密钥......"与数据操作有关,例如从Dictionary<中读取数据。 >或SQLserver。   

像这样,实际上我的字典中没有"4"键,并且出现了消息。因此,请检查您是否编写了此类代码,并确保键值正确。


4.  尽量选择像这样的选项:




如果此问题仍然存在,请您分享示例代码吗?所以我们可以直接检查它并尝试重现这个问题。


按那么,您可以检查从同一项目中的其他方法生成或从单个控制台应用程序中的Main方法生成是否可以工作。它帮助我们找到原因
的问题。



最好的问候。


萨拉


i want to generate a sequence diagram from my C# code on VS 2013. Its a web api app, but when i click on generate sequence diagram a message appears: the given key was not present in the dictionary. I don't know what it means.... HELP!!!

解决方案

Hi Mishu175,

Welcome to the MSDN forum.

Refer to the error message, please have a try with the following to troubleshot this issue:

  1. Before you click on generate a sequence diagram, please rebuild the solution and make sure successful rebuild.
  2. After that, right-click within the Method from which you want to generate diagram. (make sure generate diagram in a method)
  3. Always the message "the key in not present…" is related to data operations like reading data from Dictionary< > or SQLserver.   

Like this, actually I don’t have the key "4’’ in my dictionary, and the message occurs. So check if you write such code and make sure the key-values are right.

4. Try to choose options like this:

If this issue persists, could you please share the sample code? So we can check it directly and try to reproduce this issue.

By the way, could you check if generating from other methods in the same project or generating from Main method in a single Console app can work. It helps us locate the cause of issue.

Best regards.

Sara


这篇关于字典中没有给定的密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆