I have a simple program. Its job is to move files from A to B (a glorified bat file honestly).
The problem I'm having is that it crashes... at the end.
App.xaml.cs:
<Application x:Class="app.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:properties="clr-namespace:app.Properties"
StartupUri="Views\MainWindow.xaml">
<Application.Resources>
<properties:Settings x:Key="Settings" />
</Application.Resources>
</Application>
App.CS:
using System.ComponentModel;
using System.Linq;
using System.Windows;
using app.Model;
using app.Properties;
using app.Views;
namespace app
{
public partial class App
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
string xmlDoc = Settings.Default.Config;
var parms = new MoveFilesParams(xmlDoc);
Process.MoveFiles(parms);
}
}
}
Simple body. Assuming I pass it no command line parameter, it's supposed to just run automatically. With parameters, it will run the WPF.
It pulls settings from the xmlDoc populated in the Application settings. It then passes those settings via Parms class. Then it either runs, or popu
When run, I've tried a try/catch without errors inside the OnStartup - and it errors out after the OnStarup block with a NullReferenceException.
Edit 1: Sorry if I'm not responding fast enough (Yay for impatient people downvoting because they are impatient), but I've removed the background worker parts since I'm not using that right now. I'm still getting the same Null error at the end. Updated code here to reflect removal of BackgroundWorker.
Edit 2: Removed the GUI aspect of App.cs (since background worker and gui is secondary atm). So this program, as of right now, simply
- loads
- pulls xml location from app.config
- loads parm class from XmlDoc
- Moves Files successfully
- crashes with NullReferenceException was Unhandled error. I can comment out everything and it erros on "finish" of OnStart