When a type references itself in its declaration (e.g. class A : IEnumerable<A>), VS-MEF would crash the process with a stack overflow.
Fix
While supporting such a case may be fairly simple in principle, serialization of the catalog with reference cycles goes beyond what our current serialization technology can handle. So instead of supporting such cycles by allowing them to be legit types in the catalog, I 'support' them by recognizing and throwing them out of the catalog, and logging the error.
The first of the commits in this PR actually worked toward fully supporting recursive MEF parts, but the subsequent commit buries it. If we ever decide to support it, that commit can be resurrected as it gets us a first step toward supporting it.
Bug being fixed
When a type references itself in its declaration (e.g.
class A : IEnumerable<A>
), VS-MEF would crash the process with a stack overflow.Fix
While supporting such a case may be fairly simple in principle, serialization of the catalog with reference cycles goes beyond what our current serialization technology can handle. So instead of supporting such cycles by allowing them to be legit types in the catalog, I 'support' them by recognizing and throwing them out of the catalog, and logging the error.
The first of the commits in this PR actually worked toward fully supporting recursive MEF parts, but the subsequent commit buries it. If we ever decide to support it, that commit can be resurrected as it gets us a first step toward supporting it.