locked
Custom Settings Provider Breaking Designer

    Question

  • In Visual Studio 2005 or 2008, when adding any User Controls to a Windows Form or other User Control in a Project that implements and is using a custom settings provider, a "Failed to create component" error is displayed. If all references to the custom settings provider are removed from settings.settings and that file is saved then User Controls can be added to Windows Forms and User Controls. However, if the custom settings provider is referenced again in settings.settings, then opening the designer of a Form/Control which includes a User Control results in a "One or more errors encountered while loading the designer..." error message.

     

    I have had a very difficult time in tracking down the root cause of this issue because I assumed it had to do with my code and not the IDE. I am working within the context of a large project which uses User Controls heavily and have written a custom settings provider to persist user settings to a SQL Express database. This settings provider works properly, however if I want to open any Forms or User Controls in designer view I must first manually remove all references to my custom settings provider in setting.settings and then re-add them after the changes are done which is inconvenient to say the least.  I can provide a small sample solution to demonstrate this beharior.

     

    This problem is not present if the Project is in C#.

    Thursday, December 06, 2007 3:07 AM

All replies

  • 56 views but no replies ... has anyone else even come across this?  I have tried this on multiple computers with the same result, so I don't believe it has anything to do with my configuration.
    Thursday, December 13, 2007 2:58 AM
  • I am just now getting a similar problem on VS2008.  I have a custom settings provider specified by settings the individual properties of my settings designed (f4).

    Each item has my custom settings provider class.

    When I load a form in the designer I get a "ResX type SimpleSettingsProvider" not found, line 102. (simpleSettingsProvider is my class)

    No resx files that I have have anything to do with this on any line 102, so that's a problem, secondly, if I remove the custom settings provider property from all the settings, the form will load normally in the designer.

    Then, when I re-instate the custom settings provider, the form still loads OK until I close and re-open the project.  Then I get the error again.

    This is on a project I worked on in Dec 2007, and am now updating it. 

    I can only assume that a VS2008 "fix" broke this...
    Saturday, January 31, 2009 2:54 PM
  • I am getting this problem as well.
    I don't use user control but the default controls provided. I get the error when adding a new control and also with controls which use an image from My.Resources.
    Moreover the statusStrip items are not showed during runtime
    Thursday, June 04, 2009 12:51 PM
  • I'm just now getting the same problem in VS2010 (VB).

     

    When I try to open any form in a designer it will not open and instead I get the message:

     

    "The type "U3SettingsProvider" could not be found.  Ensure that the assembly containing tyhe type is referenced.  if the assembly is part of the current development project, ensure that the project has been built."

     

     

    Update: Fixed it (Nobody was more surprised than me).  I just fully qualified the provider name in the individual settings.  So where I had U3SettingsProvider (which is the name of my settings provider class) I prefixed the root namespace of the application e.g. Root.U3SettingsProvider

     

     


    Yellowbus Developer
    Thursday, June 30, 2011 1:50 PM
  • I got this same problem in VS2008 . When i use Custom Provider then my form can't load in design time is say:

    "The type 'PortableSettingsProvider' could not be found. Ensure that the assembly
    containing the type is referenced. If the assembly is part of the current
    development project, ensure that the project has been built. "

    When i take new project then it work well. But when i use it my existing project then error rise. Is there any solution to overcome this situation.

    Monday, February 20, 2012 11:04 AM