Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

File Issue - Incorrect Path
ahasnaini
#1 Posted : Monday, February 1, 2016 7:57:16 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/31/2016(UTC)
Posts: 3
Location: United Kingdom

Thanks: 3 times
As part of the tests I am creating a file and using it, when running the tests using ReSharper it works fine, when I use NCrunch I get
System.IO.FileNotFoundException : Could not find file 'C:\Users\xxx\AppData\Local\NCrunch\1217

I am generating a file in this location AppDomain.CurrentDomain.BaseDirectory, it seems like it doesn't work with NCrunch as the directory is different, i can see file is generated in the debug folder.
Remco
#2 Posted : Monday, February 1, 2016 9:51:58 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi,

Is the file being generated in a project that is referenced by the project containing the code that is using it?

If so, you need to be aware of how NCrunch wires together application domains across its workspaces. See http://www.ncrunch.net/documentation/considerations-and-constraints_assembly-colocation-assumptions.

Under NCrunch, the AppDomain.CurrentDomain.BaseDirectory will be set to the output directory of the test assembly. If you're looking for the output directory of one of your production assemblies, the safer way to locate this is by instead using reflection to find it. For example: typeof(TypeWithinAssembly).Assembly.Location

Turning on the 'Copy referenced assemblies to workspace' setting for the projects involved will often solve these problems, but this comes with a significant performance cost.
1 user thanked Remco for this useful post.
ahasnaini on 2/1/2016(UTC)
ahasnaini
#3 Posted : Monday, February 1, 2016 10:06:46 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/31/2016(UTC)
Posts: 3
Location: United Kingdom

Thanks: 3 times
Turning on the 'Copy referenced assemblies to workspace', I don't think this will resolve the problem as the test do run, but test generate a csv which is checked at the base directory, but as you said, I will use dll location and instead of the base and see if that resolves the issue
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.031 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download