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 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.