NUnit fails with System.IO.FileNotFoundException

What seemed to be out of the blue, NUnit started failing on me yesterday when I attempted to load my project. The cryptic error was:


System.IO.FileNotFoundException : File or assembly name nunit.core, or one of its dependencies, was not found.


Exception details are found at the bottom of the post. The problem? The web.config that went along with my assembly wasn’t valid because I was missing a trailing quote:


<add key=”blah” value=”missingquote />


Ooops. Thanks for the uninformative error message NUnit. That’s a half hour of my life I’ll never get back….


System.IO.FileNotFoundException…

Server stack trace:
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
   at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
   at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(MethodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)


Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
   at NUnit.Util.TestDomain.MakeRemoteTestRunner(AppDomain runnerDomain)
   at NUnit.Util.TestDomain.Load(String assemblyFileName, String testFixture)
   at NUnit.Util.TestLoader.LoadTest(String testName)

3 Responses to NUnit fails with System.IO.FileNotFoundException

  1. Brent Murry says:

    Hey Brent, your post has been up for three days now and you haven’t managed to generate any sympathy for creating badly formed XML. =P

    I do agree that maybe an XML-centric warning may have been more appropriate than file not found errors though.

    Slightly in gest,

    Brent

  2. Noah says:

    A malformed xml file screwed me up too. You saved me hours of my life.

    I blame it on the programmer who committed it though. Shame on you for malformed xml.

    Thanks,
    Noah

  3. Fredrik says:

    Thanks for that post; saved me loads of time, even though it did not solve my problem. I have really checked my config file truly thoroughly, and it is indeed well formed XML. My software will read it and use it correctly, but Nunit won’t run when I use the config file. At least I know now in which area the error is. As you said, the error message does not really give any useful pointers…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.