Print Page | Close Window

MEF Error Message

Printed From: IdeaBlade
Category: Cocktail
Forum Name: Community Forum
Forum Discription: A professional application framework using Caliburn.Micro and DevForce
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3983
Printed Date: 22-Jan-2026 at 2:51pm


Topic: MEF Error Message
Posted By: gregweb
Subject: MEF Error Message
Date Posted: 06-Feb-2013 at 5:16pm
One issue I have with MEF is the apparent lack of descriptive exceptions.

For example, if my ViewModel imports a SubViewModel which itself has an import error, the resulting error message at runtime is simply that the ViewModel could not be found.

Now, looking at the debug window shows more detailed messages about what went wrong that can be used to resolve.

But I would rather get a runtime exception of the original error. I know in the past I have spent a lot of time trying to trace this type of error to it's source.

Anyhow, am I missing something, or is this the only debugging possible of MEF?

Greg



Replies:
Posted By: mgood
Date Posted: 07-Feb-2013 at 8:25am
No, you are not really missing anything. What platform are you developing on? What you describe is pretty much state of the art for Silverlight and .NET 4. There is some debugging and diagnostics stuff in MefContrib, but unfortunatley that project is dead. In .NET 4.5 however things have improved. The lack of diagnositc and debugging info was a major criticism on MEF and Microsoft has improved things. The runtime exceptions in .NET 4.5 are much more descriptive and tell you the actual problem.


Posted By: gregweb
Date Posted: 07-Feb-2013 at 8:31am
Thanks, just moved over to .NET 4.5 and enabled the MEF exceptions and that is much better now.

Greg



Print Page | Close Window