MEF 默默地停止在部署目录中查找导出?
当我的部署目录包含 System.Windows.Controls.Layout.Toolkit.dll MEF“中断”时...我所做的就是在我的项目中添加对此文件的引用以及以下诊断代码向 VS 输出窗口写入无内容:
this.CompositionContainer.ExportsChanged += (s, args) =>
{
var o = args.AddedExports;
o.ToList().ForEach(export =>
System.Diagnostics.Debug
.WriteLine("MEF export: " + export.ToString()));
};
...当引用被删除时,ExportsChanged
事件将触发。这个问题是我的“特殊”问题还是地球上的其他人可以重现这个问题?
When my Deployment Catalog contains System.Windows.Controls.Layout.Toolkit.dll
MEF 'breaks'... All I'm doing is adding a reference to this file in my project and the following diagnostics code writes nothing to the VS Output Window:
this.CompositionContainer.ExportsChanged += (s, args) =>
{
var o = args.AddedExports;
o.ToList().ForEach(export =>
System.Diagnostics.Debug
.WriteLine("MEF export: " + export.ToString()));
};
...when the reference is removed the ExportsChanged
event fires. Is this problem my "special" problem or can someone else on Earth reproduce this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保您订阅 DeploymentCatalog 的
DownloadCompleted
事件。在您的事件处理程序中,检查 EventArgs 的Error
属性,它可能会告诉您问题是什么。Make sure you are subscribing to the
DownloadCompleted
event of the DeploymentCatalog. In your event handler, check theError
property of the EventArgs, and it will probably tell you what the problem is.