Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / June 2005

Tip: Looking for answers? Try searching our database.

COM interop TypeLoadException with NUnit

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Greg Bacon - 16 Jun 2005 16:56 GMT
Sorry about the multipost, but I realized too late after I posted to
m.p.d.l.c# that my question might be more appropriate in this group.

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 TypeLoadException 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.TACGRAPHDOCLib, Version=1.0.0.0, Culture=neutral,
   PublicKeyToken=null.
     at AIM.Jvmf.CJvmfK05_17Message.GetXml()
     at JvmfUnitTests.K0517GetXml.NoModifierDuplicates() 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
Greg Bacon - 16 Jun 2005 19:16 GMT
: [...]
: Catching the exception and probing a little, I see the following:
[quoted text clipped - 7 lines]
:    No InnerException.
:    HRESULT = 0x80131522

As a shot in the dark, I printed Environment.CurrentDirectory in that
catch block.  It turns out that pwd was the build directory of another
test project in that solution.

To check, I copied the interop assembly to that directory, and the test
executed happily from NUnit GUI, so it appears that I've hit an NUnit
problem.

Thanks,
Greg

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.