简体   繁体   中英

Azure MEF Open generics

I have very strange problem, the open generics exports are not discovered by assembly catalog when working under Microsoft Azure Worker role.

The assembly catalog didn't see the open generic export while it can see ordinary non generic exports just fine.

Otherwise when exporting from web role, the open generic export discovered and imported without any problem.

When switched the MEF from .Net framework 4.5 built in MEF 2.0 to Microsoft.Composition 2.0 from nuget, the open generic export working just fine.

Any clue why this happen with MEF 2.0? Is this something related to Azure worker roles, or limitation in MEF 2.0 library itself?

I attached a test cloud project to show the problem. To run the project you will need VS 2012 and Azure SDK 2.0

Project Link

After several trials and massive reading, I found using Microsoft.Composition from codeplex here , it works very well under the Azure worker.

For me, after all the troubles I faced with MEF, I decided to switch to much more reliable IOC variance Unity.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM