我最近安装了Visual Studio 2010,并将旧的VS2005解决方案复制并转换为VS2010
当我编辑这个解决方案时,如果我尝试更改控件的.image属性,VS2010会创建一个消息框,告诉我"已经添加了一个具有相同键的项目"(下面的屏幕截图),并且不会让我浏览一个图像.
我可以为任何其他解决方案添加图像,甚至是从VS2005移植的其他解决方案,但不是这个.知道我做错了什么吗?
已添加具有相同键的项目.http://img121.imageshack.us/img121/3592/errorsy.jpg
好的,这是一个棘手的问题.希望这里有一位表达大师能够发现我在这里做错了什么,因为我只是没有得到它.
我正在构建用于过滤查询的表达式.为了简化这个过程,我有几个Expression<Func<T, bool>>扩展方法,使我的代码更清晰,到目前为止,他们已经很好地工作.我已经为所有人编写了测试,除了一个,我今天写了一个.并且该测试完全失败ArgumentException,具有长堆栈跟踪.我只是不明白.特别是因为我在查询中成功使用了该方法一段时间了!
无论如何,这是运行测试时得到的堆栈跟踪:
failed: System.ArgumentException : An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Linq.Expressions.ExpressionCompiler.PrepareInitLocal(ILGenerator gen, ParameterExpression p)
at System.Linq.Expressions.ExpressionCompiler.GenerateInvoke(ILGenerator gen, InvocationExpression invoke, StackType ask)
at System.Linq.Expressions.ExpressionCompiler.Generate(ILGenerator gen, Expression node, StackType ask)
at System.Linq.Expressions.ExpressionCompiler.GenerateBinary(ILGenerator gen, BinaryExpression b, StackType ask)
at System.Linq.Expressions.ExpressionCompiler.Generate(ILGenerator gen, Expression node, StackType ask)
at System.Linq.Expressions.ExpressionCompiler.GenerateUnliftedAndAlso(ILGenerator gen, BinaryExpression b)
at System.Linq.Expressions.ExpressionCompiler.GenerateAndAlso(ILGenerator gen, BinaryExpression b, StackType ask)
at System.Linq.Expressions.ExpressionCompiler.GenerateBinary(ILGenerator …Run Code Online (Sandbox Code Playgroud) 当我尝试在窗体设计器中更改Windows窗体上的控件的默认图像时(无论在哪个控件上),我收到此错误:
错误消息:已添加具有相同键的项目
我试图删除并重新创建Resources.resx文件..我保证只有1个具有这些密钥的resx文件存在..(实际上这是我唯一的资源文件)但它仍然不起作用.
我有som字符串和一些图像.就这样.
任何的想法?