Jim
Jim

Reputation: 2828

WPF load File error

I have very strange error.

I am loading a .csv file successfully in my WPF ListView, like this

var lines = File.ReadAllText(@"Data\File.csv").Split('\n').Where(arg => !string.IsNullOrWhiteSpace(arg));

But, during Debugging and I am getting an error "Could not find a part of path 'C\Program Files(x86)\Microsoft visual studio 11\Common\IDE\Data\File.csv"

Why it is looking in the above folder? Thank you in advance.

.

Upvotes: 0

Views: 263

Answers (1)

Csaba Toth
Csaba Toth

Reputation: 10697

If you get an error while you are editing, the Designer tries to be smart and display the data for you even design time. That makes sense, the designer is VS IDE component, and it probably has that C:\Program Files(x86)\Microsoft visual studio 11\Common\IDE\ as working directory. You have some choices:

  1. Specify full path. But that's not suitable for release.
  2. You can determine Design mode.

Upvotes: 1

Related Questions