1

次のエラーを受け取りまし"Attempted to read or write protected memory"richTextBox_Console.AppendText

public void ConsoleWriteLine(string formatedText, bool urgent = false)
{
    try
    {
        if (richTextBox_Console.InvokeRequired)
        {
            richTextBox_Console.BeginInvoke(new ConsoleWriteDelegate(ConsoleWriteLine), formatedText, urgent);
            return;
        }
        else
        {
            if (!tabPage_Console.Focused && urgent)
                tabPage_Console.Text = "Console(!)";
            richTextBox_Console.AppendText(formatedText + Environment.NewLine);
        }
    }
    catch (Exception Exc)
    {
        Testing.ExceptionHandler.HandleException(Exc);
    }
}

public static MainForm View;
[STAThread]
static void Main()
{
    FlatfileDB.Load();
    LoadDatabase();

    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);

    View = new MainForm();
    Application.Run(View);
}

public static void HandleException(string Exc)
{
    try
    {
        using (StreamWriter writer = new StreamWriter("Exceptions.txt", true))
        {
            writer.WriteLine(string.Format("[{0}] \r\n{1}\r\n", DateTime.Now.ToString(), Exc.ToString()));
            writer.Flush();
        }
        Program.View.ConsoleWriteLine("Exception has been handled. See Exceptions.txt", true);
    }
    catch { }
}

なぜこれが起こったのかについての説明は素晴らしいでしょう.

  • このエラーはすぐには発生せず、数時間かけて発生したことに注意してください。
  • 私はネット4.5を使用しています
4

0 に答える 0