开发者

How to troubleshoot a double loaded object in mef

I have an issue where my object is loaded twice in MEF. So MEF returns two of my object, which causes my entire program to crash because I am expecting only one.

How can I trace through/step through my program to figure out where the objects are being double registered?

I have an Export tag on the class. I assume this accounts for one of the instances.

I am using prism and the开发者_JAVA技巧 object that appears twice is the Shell view.

TDL having trouble figuring out how to debug mef


When you compose the object, MEF will raise a CompositionException when it tries to compose the [Import] matching the type. The exception details of the CompositionException are very detailed, and will give you the potential matches.

Look at the full text of the CompositionException - it should provide you with all of the "matches" that are occurring for a given import, allowing you to debug the issue.


I'd venture to say you loaded the Assembly twice into the AggregateCatalog somehow.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜