Re: NUnit core assembly referencing

"Charlie Poole" <[email protected]> Sun, 13 Apr 2008 11:50:20 -0700
Newsgroups gmane.comp.windows.dotnet.nunit.devel
Message-ID <007a01c89d97$3b1b8160$6401a8c0@ferrari>
Hi Gary,
 
Writing addins that will work across multiple versions of NUnit was
something I had
been holding off till 3.0, since the manner of loading assemblies will
change with
that release. That said, it's reasonable to explore the problem now - if
nothing
else, it will tell us how to deal with it later.
 
Bear in mind that your config file changes only affect the primary
AppDomain.
CoreExtensions runs in the test AppDomain. However, NUnit actually forces
the nunit.core and nunit.core.interfaces into the test AppDomain after the
test domain is unable to load them. Therefore, it's (ironically) important
that
they NOT be available to the test appdomain. If you have your attributes
in your addin assembly, rather than a separate assembly, you will break
this mechanism. I'll assume you don't.
 
The failure in CoreExtensions is probably happening at the point where
the implemented interface is compared to the actual interface. Can you
get enough of a trace to see if that's so?
 
Charlie


  _____  

From: [email protected]
[mailto:[email protected]] On Behalf Of Gary
Evans
Sent: Sunday, April 13, 2008 9:45 AM
To: [email protected]
Subject: [nunit-developer] NUnit core assembly referencing


Hiya,
 
I tried loading my extensions, built against NUnit 2.4.6 in NUnit 2.4.7. I
wasn't expecting it to work without tweaking, but I'm surprised that I
couldn't tweak app.config to work without a rebuild of my extension.
 
FileNotFound extensions were thrown from CoreExtensions.InstallAddins - the
correct versions of the NUnit.Core.dll and NUnit.Core.Interfaces.dlls could
not be found (was looking for 2.4.6.0).
 
I inserted the following into NUnit gui's App.Config:
 
   <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
     <dependentAssembly>
       <assemblyIdentity name="NUnit.Core"
publicKeyToken="96d09a1eb7f44a77"/>
       <bindingRedirect oldVersion="2.4.6.0" newVersion="2.4.7.0"/>
       <codeBase version=""
href="file:///D:\FILES\GAZSTUFF\Rakija\NUnit2.4.7\NUnit-2.4.7-src\src\GuiRun
ner\nunit-gui-exe\bin\Debug2005\NUnitCore.dll"/
<file:///D:\FILES\GAZSTUFF\Rakija\NUnit2.4.7\NUnit-2.4.7-src\src\GuiRunner\n
unit-gui-exe\bin\Debug2005\NUnitCore.dll> >
     </dependentAssembly>
     <dependentAssembly>
       <assemblyIdentity name="NUnit.Core.Interfaces"
publicKeyToken="96d09a1eb7f44a77"/>
       <bindingRedirect oldVersion="2.4.6.0" newVersion="2.4.7.0"/>
       <codeBase version=""
href="file:///D:\FILES\GAZSTUFF\Rakija\NUnit2.4.7\NUnit-2.4.7-src\src\GuiRun
ner\nunit-gui-exe\bin\Debug2005\NUnitCoreInterfaces.dll"/
<file:///D:\FILES\GAZSTUFF\Rakija\NUnit2.4.7\NUnit-2.4.7-src\src\GuiRunner\n
unit-gui-exe\bin\Debug2005\NUnitCoreInterfaces.dll> >
     </dependentAssembly>
   </assemblyBinding>
 
This fixed the NUnit.Core problem, but not the NUnit.Core.Interfaces.dll
problem (strangely!)
 
Am I missing a simple step, or is there no way to get this to work without
rebuilding against the later NUnit assemblies (which does work).
 
It's likely that we'd want to reuse as much functionality as possible - we
wouldn't want to duplicate too much code just to avoid this problem? (I'm
thinking of deriving a ParameterizedTestCase, which would derive from
NUnitTestCase, for instance)
 
As an aside - would it be possible to show the user these file load
exceptions somewhere - I knew what was wrong with my addin, but it might
take a user by surprise if they couldn't see the actual errors - maybe the
list of addins in the addins window which currently just shows "error" could
have a link to click on showing the errors in instantiating the addin?
 
Cheers,
Gary


  _____  

News, Sports, Entertainment and Weather on your mobile. Text MSN to
<http://mobile.uk.msn.com/pc/msn_content.aspx> 63463 Now.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

_______________________________________________
nunit-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-developer