Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MEF parts should initialize with all-free-threaded code #1688

jcansdale opened this Issue May 18, 2018 · 2 comments


None yet
2 participants
Copy link

jcansdale commented May 18, 2018

@AArnott wrote #1663 (comment):

MEF parts should ideally not be making any assumptions about the thread that their importer is on. One design point of MEF is to provide IoC-like benefits, but you lose those when you make assumptions that you know who all your importers are and have an implicit contract that they always activate you on a particular thread. Similarly, MEF parts should not have thread affinity (i.e. they shouldn't try to switch to the thread they require) during activation, since that can lead to deadlocks. MEF parts should initialize with all-free-threaded code, and do any thread affinitized initialization later when the importer calls one of its methods explicitly (preferably asynchronously).

Some of our MEF services only work properly when they're constructed on the Main thread. This makes MEF initialization error prone and potentially dependent on the order in which components are used. We should ensure that all of our shared MEF components are free-threaded.

@meaghanlewis meaghanlewis added this to the 2.5.4 milestone Jun 27, 2018


This comment has been minimized.

Copy link

meaghanlewis commented Jun 27, 2018

@jcansdale can this be closed now that #1689 has been merged?


This comment has been minimized.

Copy link
Collaborator Author

jcansdale commented Jun 27, 2018

@jcansdale ah yes, well spotted! I forgot a Fixes comment. 😊

@jcansdale jcansdale closed this Jun 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.