public ActivationContextHelper(string manifestFile)
{
#if !__MonoCS__
// Specifying a full path to the manifest file like this allows our unit tests to work even with a
// test runner like Resharper 8 which does not set the current directory to the one containing the DLLs.
// Note that we have to use CodeBase here because NUnit runs the tests from a shadow copy directory
// that doesn't contain the manifest file.
string path = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath;
string location = Path.GetDirectoryName(path);
var context = new ActCtx
{
cbSize = Marshal.SizeOf(typeof(ActCtx)),
lpSource = Path.Combine(location, manifestFile)
};
IntPtr handle = CreateActCtx(ref context);
if (handle == (IntPtr)(-1))
throw new Win32Exception(Marshal.GetLastWin32Error(), "Error creating activation context");
m_activationContext = handle;
#endif
}