SettingsProvider base.Name always null, thows error on instantiation

I've created a custom Settings provider. It doesn't do much right now but I can't even use it at all (expected an erro when the SetPropertyValues was called because I haven't implimented it yet.)  But instead immediately after the constructor is called an error is thrown saying that the base.Name property is null and it must be set.  The property of course is read-only and if I call Initilize (I've only added a constructor to see what it was getting set to) it says that it has already been initialized.

What am I doing wrong

Here's my code.



    internal class AppSettingProvider : SettingsProvider {
        private string pApplicationName = "Evolution";

        public AppSettingProvider() : base() {
            Console.WriteLine(base.Name);
        }

        public override string ApplicationName {
            get {

                return pApplicationName;
            }
            set {
                pApplicationName = value;
            }
        }

        public override SettingsPropertyValueCollection GetPropertyValues(SettingsContext context, SettingsPropertyCollection collection) {
            throw new Exception("The method or operation is not implemented.");
        }

        public override void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection collection) {
            //Get the instance flag from the .config file.
            string Instance = System.Configuration.ConfigurationManager.AppSettings["Instance"];

            throw new Exception("The method or operation is not implemented.");
        }
    }

 



Answer this question

SettingsProvider base.Name always null, thows error on instantiation

  • TRW_Mike

    What version of .Net Framework are you running   I couldn't repro your problem.

    - Pat

  • SettingsProvider base.Name always null, thows error on instantiation