Quote:
Originally Posted by tlhintoq
When the program breaks, what line does it break on? What line is highlighted and has the yellow arrow pointing at?
Originally, it was breaking in my Program.cs file (the namespace is edited out):
- namespace XXXXXXXXX
-
{
-
static class Program
-
{
-
/// <summary>
-
/// The main entry point for the application.
-
/// </summary>
-
[STAThread]
-
static void Main()
-
{
-
Application.EnableVisualStyles();
-
Application.SetCompatibleTextRenderingDefault(false);
-
Application.Run(new XXXXXXXXX()); // Breaks at this line.
-
}
-
}
-
}
The error is:
TargetInvocationException was unhandled.
Exception has been thrown by the target of an invocation.
I then added in a try-catch:
- static void Main()
-
{
-
Application.EnableVisualStyles();
-
Application.SetCompatibleTextRenderingDefault(false);
-
try
-
{
-
Application.Run(new XXXXXXXXX());
-
}
-
catch (Exception ex)
-
{
-
MessageBox.Show(ex.InnerException.Message);
-
}
-
}
And now I just get a MessageBox with "Object Reference Not set to an instance of an object" with no line indication. I guessed at where the error was occurring (in one of my background workers) and narrowed it down to that one File.Move line.