Search code examples
c#.netwindowsmef

MEF doesn't work on devices with Windows 8.1 or above


I use Managed Extensibility Framework in my .NET 4 WinForms application. Everything works perfectly fine on my Windows 8, on a fresh installation of Windows XP SP3 on Hyper-V, on Windows 7 and generally everywhere below Win 8.1.

The problem occurs only in Windows 8.1 or above - there are no errors or exceptions but no plugins are found. I'm not attaching any code since I've tried running the official sample application for MEF from MSDN and even that doesn't work on 8.1 (https://code.msdn.microsoft.com/windowsdesktop/Simple-Calculator-MEF-1152654e). The exports defined in the main project work fine, but it can't find the one from DLL project.

I've tried both applications on few machines already and the result is always the same - everything works perfectly fine as long as it's below Windows 8.1...

Is there any bug in Windows 8.1 that prevents loading MEF extensions from DLLs...?


Solution

  • Found the reason - the DLL containing the modulo operation is by default blocked by the system and the user needs to manually unblock it to make it work.

    It would be nice if Windows at least noticed the user somehow that it blocked one of the files or even ask the user about it...

    Anyway, after manually unblocking the DLLs, everything works fine:

    screenshot of "unblock" option in Windows 8.1+