nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #01990
[Bug 882750] Re: Isolated COM class referenced in the test DLL not found
We created Activation Context in C# and managed to reproduce the issue
without setting the Isolation flag set. The test method below FAILS if
called as a test from NUnit version 2.5.10.11092 when COM dll is
unregistered (but in same folder) but WORKS when called from another
exe:
Test Error : ClassLibrary1.Class1.test()
System.IO.FileNotFoundException : Retrieving the COM class factory for component with CLSID {XXXXXXXXXXXX} failed due to the following error: 8007007e.
You need to provide your native COM .dll with "OurLib.OurClass"
component and a file OurLib.X.manifest. The COM.dll has to be
registered when building the C# ClassLibrary1.dll and unregistered to
run the test
public void test()
{
string fullPath = (new System.Uri(Assembly.GetExecutingAssembly().Location)).AbsolutePath.Replace("ClassLibrary1.DLL","");
string manifest = @"OurLib.X.manifest";
NativeMethods.ACTCTX info = new NativeMethods.ACTCTX();
info.cbSize = Marshal.SizeOf(typeof(NativeMethods.ACTCTX));
info.lpAssemblyDirectory = fullPath;
info.lpSource = fullPath + manifest;
IntPtr hActCtx = NativeMethods.CreateActCtx(ref info);
IntPtr cookie = IntPtr.Zero;
bool bOK = NativeMethods.ActivateActCtx(hActCtx, out cookie);
OurLib.OurClass c = new OurLib.OurClass();
** Attachment added: "contains sample class that fails to create "OurLib.OurClass" unregistered COM component"
https://bugs.launchpad.net/nunitv2/+bug/882750/+attachment/2576660/+files/Class1.problem.cs
--
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/882750
Title:
Isolated COM class referenced in the test DLL not found
Status in NUnit V2 Test Framework:
New
Bug description:
Create .Net ClassLibrary1 that references a registered COM component
and contains a class with a [TestCase] method which uses the COM
object. Set Isolated in the References to true [that will add
ClassLibrary1.manifest with <file> section]. Unregister the COM
component. The nunit test will fail with:
Test Error : ClassLibrary1.Class1.test()
System.Runtime.InteropServices.COMException : Retrieving the COM class factory for component with CLSID {###} failed due to the following error: 80040154.
at ClassLibrary1.Class1.test() in C:\temp\Projects\ConsoleApplication1\ClassLibrary1\Class1.cs:line 13
An C# console application that references the ClassLibrary1 wil work
fine.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nunitv2/+bug/882750/+subscriptions
References