C# Code Loading Plugins Fails Inside Virtual Machine

1

I am using Win7 Ultimate in a VMWare Player virtual machine, running on a Linux Mint host. Under Win7 I am using Visual Studio Express 2012 to develop an application. On startup this application loads plugins dynamically - the mechanism is fairly classic:

        var plugins = new List<IPlugin>();

        var domainInfo = new AppDomainSetup
        {
            ApplicationBase = AppDomain.CurrentDomain.BaseDirectory,
            PrivateBinPath = PluginPath
        };

        var domain = AppDomain.CreateDomain("PluginLoader", null, domainInfo);
        var pluginFiles = Directory.GetFiles(PluginPath, "my.plugin.*.dll");

        TypesInAssemblyFile finder = (TypesInAssemblyFile)domain.CreateInstanceFromAndUnwrap(
            typeof(TypesInAssemblyFile).Assembly.Location,
            typeof(TypesInAssemblyFile).FullName
        );
        var pluginFiles = Directory.GetFiles(PluginPath, "myapp.plugin.*.dll");

This works fine if the solution, project files and sources are located on the virtual machine's C: drive, or on a NAS shared folder. If, however, I move same code to another hard disk located in the same physical machine and shared with the VM using VMWare Player's folder sharing mechanism then I get a System.IO.FileLoadException at the domain.CreateInstanceFromAndUnwrap:

An unhandled exception of type 'System.IO.FileLoadException' occurred in
myapp.modules.dll

Additional information: Could not load file or assembly 'file:///G:\myapp\my\path
\bin\Debug\myapp.modules.dll' or one of its dependencies. Operation is not 
supported. (Exception from HRESULT: 0x80131515)

This physical disk is mounted using VMWare Player's shared folder mechanism, the path \\vmware-host\Shared Folders\Data is mapped to a G: drive and everything looks fine.

Does anyone have any clue why? I've loaded the DLL in Dependency Walker and don't see anything obviously wrong and the same code works fine on the virtual machine's C:.

visual-studio-2010
windows-7
express
virtual-machine
asked on Stack Overflow Mar 7, 2014 by 0xDEADBEEF

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0