頭がおかしくなる質問があります。エラーメッセージをオブジェクトの文字列に保存し、unloadContent() で文字列をファイルに書き込むプログラムがあります。何らかの理由で、サポートされていない例外が発生し続けます。unloadContent() のコードは次のとおりです。
if (debug.getContent().Length > 0)
{
saveErrors save = new saveErrors();
if (Directory.Exists(System.IO.Directory.GetCurrentDirectory() + "\\Errors")) ;
Directory.CreateDirectory(System.IO.Directory.GetCurrentDirectory() + "\\Errors");
save.save(System.IO.Directory.GetCurrentDirectory().ToString() + "\\Errors\\errorLog_" + (System.DateTime.Now.ToString().Replace("/", "_")).Replace(" ","") + ".txt");
}
クラス保存エラーのコードは次のとおりです。
public class saveErrors
{
private string mess = debug.getContent();
public void save(string fileName)
{
Debug.WriteLine(fileName);
using (StreamWriter sw = new StreamWriter(fileName))
{
sw.Write(mess);
sw.Close();
}
}
}
私はまだC#に少し慣れていないので、どんな助けでも大歓迎です!
ありがとう!