Diagnostic Tracing

Dec 14, 2008 at 12:08 AM
Will MEF implement any level of diagnostic tracing using the standard .NET TraceSwitch mechanisms, similar to WCF? This would be a nice way to debug composition problems.
Dec 15, 2008 at 4:10 PM
We're taking a different approach in release 1 that will provide much more contextual information in composition exceptions. The idea is to eliminate the need for tracing wherever possible.

Some tracing may still be available though - is there any specific case that you're thinking of?

Thanks for getting in touch!

Nick
Dec 15, 2008 at 5:37 PM
I don't really have a specific case I'm looking at. I'm in the process of rewriting an existing application to take advantage of MEF and also adding a lot of diagnostic tracing to it. I was thinking that it would be nice to be able to turn MEF tracing on or off and use the same switch name for my own MEF related tracing.

Having the contextual information in the exceptions is nice, but in order for that information to get in to a debug log of any kind all of the exceptions would need to be caught in order to log the message and then rethrown as neecessary to allow it to continue bubbling up the chain. If tracing were used, I could turn MEF exception tracing on and not need to worry about catching exceptions (and more importantly, failing to catch an exception).