locked
Custom settings provider failed to load. RRS feed

  • Question

  • We are developing outlook add in where we are using custom settings provider to save properties value which is specific to user in a different location. While we are debugging from visual studio we are getting following error. It works fine if I remove the custom provider for the property. Can someone please guide me out of this issue? 

    Failed to load provider type: xxx.yyyy.Common.XXXXXSettingsProvider, xxx.yyyy.Common, Version=5.3.30.0, Culture=neutral, PublicKeyToken=null.

    This is the stack trace

       at System.Configuration.ApplicationSettingsBase.CreateSetting(PropertyInfo propInfo)
       at System.Configuration.ApplicationSettingsBase.EnsureInitialized()
       at System.Configuration.ApplicationSettingsBase.get_Properties()
       at System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)
       at System.Configuration.SettingsBase.get_Item(String propertyName)
       at System.Configuration.ApplicationSettingsBase.GetPropertyValue(String propertyName)
       at System.Configuration.ApplicationSettingsBase.get_Item(String propertyName)
       at xxxx.UI.Properties.Settings.get_TooltipVisible() in xxxx\Settings.Designer.cs:line 400
       

    Property where we are using the custom provider.

    [global::System.Configuration.UserScopedSettingAttribute()]
            [global::System.Configuration.SettingsProviderAttribute(typeof(xxx.yyy.Common.xxxxSettingsProvider))]
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.Configuration.DefaultSettingValueAttribute("True")]
            public bool TooltipVisible {
                get {
                    return ((bool)(this["TooltipVisible"]));
                }
                set {
                    this["TooltipVisible"] = value;
                }
            }


    Wednesday, August 10, 2016 12:29 PM

Answers

  • Hi Arun.rajendra,

    Thank you for posting here.

    Maybe this is what you look for. How to make settings provider inside a dynamically loaded assembly available for reflection?

    You could refer to the link to create your custom settings provider in the legacy C# app you are developing

    public sealed class MySettings : SettingsProvider
    {
        ...
    }
    
    [SettingsProvider(typeof(MySettings))]
    internal sealed partial class Settings {}

    I hope the reply would be helpful.

    Best Regards,

    Hart


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    • Proposed as answer by DotNet Wang Wednesday, August 24, 2016 4:33 AM
    • Marked as answer by DotNet Wang Wednesday, August 24, 2016 4:33 AM
    Friday, August 12, 2016 5:36 AM

All replies

  • Hello Arun,

    Not sure but I would verify the .net framework version is the same across the projects and that the assembly is referenced correctly.  In other words, make sure the program that is running Settings.Designer.cs has the xxx.yyyy.Common assembly in the same folder.

    Similar issues reported:

    • http://stackoverflow.com/questions/15153420/how-to-make-settings-provider-inside-a-dynamically-loaded-assembly-available-for
    • sometimes it is just human error: https://www.gittprogram.com/question/3125345_failed-to-load-provider-type.html
    • http://databaseforum.info/25/980252.aspx
    • https://www.gittprogram.com/question/3125345_failed-to-load-provider-type.html

    Jeff

    Wednesday, August 10, 2016 8:27 PM
  • How is your code structured? Thus in what project is your provider located? Can you post a concise and complete sample?
    Wednesday, August 10, 2016 8:43 PM
  • Thanks Stefan

    This is the project structure

    Presentation layer -> Properties ->Settings.Designer.cs

     (This is different subproject) xxx.yyyy.Common->CustomSettingsProvider.cs


    Thursday, August 11, 2016 10:29 AM
  • Yes Jeff all dll are in single folder. 
    Thursday, August 11, 2016 10:31 AM
  • Hmmm... Not sure; one more thing to make sure but it is a long shot.  Can you check the two projects framework version and post this?  I have been in a similar situation in the past just because one project was .net 4 and the other was .net 3.5.  

    Like I said, long shot.

    As Stefan points out, the next think I would try is to take a working hello world solution then slowly build it into your solution.  I usually find the issue early on so it tends not to take as much time as it might sound.


    Jeff

    Thursday, August 11, 2016 8:11 PM
  • Hi Arun.rajendra,

    Thank you for posting here.

    Maybe this is what you look for. How to make settings provider inside a dynamically loaded assembly available for reflection?

    You could refer to the link to create your custom settings provider in the legacy C# app you are developing

    public sealed class MySettings : SettingsProvider
    {
        ...
    }
    
    [SettingsProvider(typeof(MySettings))]
    internal sealed partial class Settings {}

    I hope the reply would be helpful.

    Best Regards,

    Hart


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    • Proposed as answer by DotNet Wang Wednesday, August 24, 2016 4:33 AM
    • Marked as answer by DotNet Wang Wednesday, August 24, 2016 4:33 AM
    Friday, August 12, 2016 5:36 AM