Improved error messages so that it becomes clear where configuration errors come...
[mono.git] / mcs / class / System.Configuration / System.Configuration.Provider / ProviderBase.cs
index f96ba49f752fd1758c771f8cbd6e01b462da3af3..66c423c6fbb4262e308f022372b4f046b4e1c281 100644 (file)
@@ -47,16 +47,18 @@ namespace System.Configuration.Provider
                        if (name == null)
                                throw new ArgumentNullException ("name");
                        if (name.Length == 0)
-                               throw new ArgumentException ("name must not be empty");
+                               throw new ArgumentException ("Provider name cannot be null or empty.", "name");
                        if (alreadyInitialized)
-                               throw new InvalidOperationException ("Provider has already been initialized");
+                               throw new InvalidOperationException ("This provider instance has already been initialized.");
                        alreadyInitialized = true;
                        
                        _name = name;
 
-                       if (config != null)
-                               _description = config["description"];
-                       if (_description == null)
+                       if (config != null) {
+                               _description = config ["description"];
+                               config.Remove ("description");
+                       }
+                       if (String.IsNullOrEmpty (_description))
                                _description = _name;
                }