0
このコードに問題があります。 StackOverflowExceptionが発生しました。エラーは、StreamReader readFile = new StreamReader(path)
行で発生しました。StreamReaderコンストラクタのStackOverflowException
誰もがこの問題を解決する方法を知っていますか?ありがとうございました。
public string[,] parseCSV(string path)
{
List<string[]> parsedData = new List<string[]>();
try
{
using (StreamReader readFile = new StreamReader(path))
{
string line;
string[] row;
baris = File.ReadAllLines(path).Length;
row = readFile.ReadLine().Split(',');
col = row.Length;
store = new string[baris, col];
int i = 0;
int j = 0;
foreach (string kolom in row)
{
store[i, j] = kolom;
j++;
}
i=1;
while ((line = readFile.ReadLine()) != null)
{
row = line.Split(',');
j = 0;
foreach (string kolom in row)
{
store[i, j] = kolom;
j++;
}
i++;
parsedData.Add(row);
}
}
}
catch (Exception e)
{
//MessageBox.Show(e.Message);
}
return store;
}
'path 'は例外の原因となりますか? – abatishchev
エラーが発生した場合、IDEにコールスタックウィンドウを表示して、それがどのように見えるか、つまりparseCSVとは何回何回呼び出されたのかを教えてください。 "path"変数の値は何ですか? StreamReaderは.NETフレームワーククラスですか、独自のSteramReaderを作成しましたか? – BlueMonkMN
使用しているStreamReaderコンストラクタはStackOverflowExceptionをスローしません。スタックトレースを投稿できますか? –