Build/Test Issues

File not found exception

Started by Melle on 7,064 views


One of the projects has an XML file included in the project which is read.

However, NCrunch is not able to find the file, even in the properties we select to 'copy always' for this particular file.

Here's the exception thrown:

--
System.Exception : Configured DeploymentGroup could not be loaded
----> Haddock.Business.Logging.HaddockException : Could not load DeploymentGroup xml file
----> System.IO.DirectoryNotFoundException : Could not find a part of the path 'C:\Users\mkoning.DEV\AppData\Local\NCrunch\5680\Applications\PollingService\Haddock.Applications.PollingService.Core\xml\DeploymentGroups.xml'.
at Haddock.Applications.PollingService.Core.Poller.GetConfiguredDeploymentGroupFromXmlFile() in D:\Haddock\IdeFix\Sprint10\SL\Applications\PollingService\Haddock.Applications.PollingService.Core\Poller.cs:line 216#0
at Haddock.Applications.UnitTest.PollingService.TestPollingService.PollerTest.GetDeploymentGroups() in D:\Haddock\IdeFix\Sprint10\SL\Applications\PollingService\Haddock.Applications.UnitTest.PollingService\TestPollingService.cs:line 80#1
at Haddock.Applications.UnitTest.PollingService.TestPollingService.GetDeploymentGroupsAndAffiliatesToBeIgnored_SUCCEED() in D:\Haddock\IdeFix\Sprint10\SL\Applications\PollingService\Haddock.Applications.UnitTest.PollingService\TestPollingService.cs:line 42#2
--HaddockException
at Haddock.Business.Services.DeploymentGroups.DeploymentGroupService.ReadDeploymentGroupsFromXml() in D:\Haddock\IdeFix\Sprint10\SL\Business\Haddock.Business.Services\DeploymentGroups\DeploymentGroupService.cs:line 60#3
at Haddock.Applications.PollingService.Core.Poller.GetConfiguredDeploymentGroupFromXmlFile() in D:\Haddock\IdeFix\Sprint10\SL\Applications\PollingService\Haddock.Applications.PollingService.Core\Poller.cs:line 191#4
--DirectoryNotFoundException
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver)
at System.Threading.CompressedStack.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.CompressedStack.Run(CompressedStack compressedStack, ContextCallback callback, Object state)
at System.Xml.XmlTextReaderImpl.OpenUrl()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at Haddock.Business.Services.DeploymentGroups.DeploymentGroupService.ReadDeploymentGroupsFromXml() in D:\Haddock\IdeFix\Sprint10\SL\Business\Haddock.Business.Services\DeploymentGroups\DeploymentGroupService.cs:line 41#5

--

Our assumption is that the xml file (which is included in the PollingService.Core project) should be copied by the NCrunch build process, right?
Hi,

Yes, your assumption is correct. NCrunch should normally identify the file as being a part of the project, and copy it to the workspace so that the tests can run as usual.

It's possible that the markup being used to include this xml file in the .proj isn't being recognised by NCrunch and that it fails to notice the file. Issues such as this were quite common in the early builds of NCrunch and it wouldn't surprise me if there are still some file inclusion methods that NCrunch isn't covering.

Can you share the XML syntax being used to include the file in the .proj file?

You can probably work around this issue by adding a relative path to the file in your 'Additional files to include' NCrunch project-level configuration option for its relevant project.

Post a reply

Log in to reply.