使用资源时出现 TargetInitationException
目前,我在解决方案中使用资源时似乎遇到了一些问题。我在几个确实应该有任何错误的地方收到 TargetInvocableException...
自己的代码:
commands.Add(new AddDatabaseItemCommand(设置, IconResources.DatabaseObject, this));
DatabaseObject 是一个 Icon,它确实包含在 IconResources.resx 文件中,并设置为“在编译时链接”。这已经工作了几个星期,没有出现任何问题。
设计器生成的代码:
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
完全相同的问题,这是表单的图标,并且再次在资源文件“formName.resx”文件中作为图标,由设计器自动放置在那里。该图标上的选项是“嵌入.resx”。
InnerException甚至厚颜无耻地说“操作成功完成”!
有人知道会发生什么吗?我的同事使用相同的代码没有任何问题......
I seem to be having some issues using resources in my solution at present. I'm getting a TargetInvocationException in a couple of places where there really should be any errors...
Own code:
commands.Add(new AddDatabaseItemCommand(setting,
IconResources.DatabaseObject, this));
The DatabaseObject is an Icon, that is indeed contained in the IconResources.resx file and is set to "linked at compile time". This has been working for a few weeks without issue.
Designer generated code:
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
Exactly the same problem, this is the Icon for a Form, and again is within the resources file "formName.resx" file as an Icon, placed there automatically by the designer. The options on this icon are "Embedded in .resx".
The InnerException even has the cheek to say "The operation completed successfully"!
Anyone have any idea what might be going on? My colleagues with the same code aren't have any issues...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论