diff --git a/NzbDrone.Core/Configuration/ConfigFileProvider.cs b/NzbDrone.Core/Configuration/ConfigFileProvider.cs
index fa694700d..d571bb8b8 100644
--- a/NzbDrone.Core/Configuration/ConfigFileProvider.cs
+++ b/NzbDrone.Core/Configuration/ConfigFileProvider.cs
@@ -140,7 +140,7 @@ namespace NzbDrone.Core.Configuration
{
EnsureDefaultConfigFile();
- var xDoc = XDocument.Load(_configFile);
+ var xDoc = LoadConfigFile();
var config = xDoc.Descendants(CONFIG_ELEMENT_NAME).Single();
var parentContainer = config;
@@ -162,7 +162,7 @@ namespace NzbDrone.Core.Configuration
{
EnsureDefaultConfigFile();
- var xDoc = XDocument.Load(_configFile);
+ var xDoc = LoadConfigFile();
var config = xDoc.Descendants(CONFIG_ELEMENT_NAME).Single();
var parentContainer = config;
@@ -203,7 +203,7 @@ namespace NzbDrone.Core.Configuration
{
EnsureDefaultConfigFile();
- var xDoc = XDocument.Load(_configFile);
+ var xDoc = LoadConfigFile();
var config = xDoc.Descendants(CONFIG_ELEMENT_NAME).Single();
var type = GetType();
@@ -222,6 +222,19 @@ namespace NzbDrone.Core.Configuration
xDoc.Save(_configFile);
}
+ private XDocument LoadConfigFile()
+ {
+ try
+ {
+ return XDocument.Load(_configFile);
+ }
+
+ catch (Exception ex)
+ {
+ throw new InvalidConfigFileException("config.xml is invalid, please see the wiki for steps to resolve this issue.", ex);
+ }
+ }
+
public void HandleAsync(ApplicationStartedEvent message)
{
DeleteOldValues();
diff --git a/NzbDrone.Core/Configuration/InvalidConfigFileException.cs b/NzbDrone.Core/Configuration/InvalidConfigFileException.cs
new file mode 100644
index 000000000..3b3dbc5ea
--- /dev/null
+++ b/NzbDrone.Core/Configuration/InvalidConfigFileException.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NzbDrone.Common.Exceptions;
+
+namespace NzbDrone.Core.Configuration
+{
+ public class InvalidConfigFileException : Exception
+ {
+ public InvalidConfigFileException(string message, Exception innerException) : base(message, innerException)
+ {
+ }
+ }
+}
diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj
index 8fa7bbee6..409494e92 100644
--- a/NzbDrone.Core/NzbDrone.Core.csproj
+++ b/NzbDrone.Core/NzbDrone.Core.csproj
@@ -123,6 +123,7 @@
+