COM interop TypeLoadException with NUnit

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Greg Bacon

    COM interop TypeLoadException with NUnit

    I have two C# projects: a production project and NUnit tests for it.
    I've recently added a test that causes a call into a registered COM
    component, and now the test fails with a TypeLoadExcepti on when it
    tries to load the interop assembly.

    However, when I use the TestDriven.NET addin -- run via either
    Debugger or In-Proc -- the test runs fine.

    In trying to get a better idea of the problem, I found Suzanne Cook's
    blog. I tried examining the Fusion log, but all it shows are attempts
    to load nunit.uikit, not the interop assembly that the exception
    complains about.

    Catching the exception and probing a little, I see the following:

    Could not load type TACGRAPHDOCLib. TGDocumentClass from assembly
    Interop.TACGRAP HDOCLib, Version=1.0.0.0 , Culture=neutral ,
    PublicKeyToken= null.
    at AIM.Jvmf.CJvmfK 05_17Message.Ge tXml()
    at JvmfUnitTests.K 0517GetXml.NoMo difierDuplicate s() in
    ...\k0517getxml .cs:line 41
    No InnerException.
    HRESULT = 0x80131522

    I searched for other people reporting problems related to that hresult,
    but the hits were VB issues, and none of the advice they got seemed
    applicable to my situation.

    I tried messing with the reference from the NUnit project to the COM
    component, i.e., directly as a COM reference, browsing to the production
    project's copy of the interop assembly, and cutting it out. No joy.

    The fact that I can run the test without exception through TD.NET must
    be a clue -- or at least a Scooby snack. I'd appreciate any guidance
    the group might offer, even if it's only for ways to find more verbose
    debug information.

    Thanks,
    Greg
Working...