New Posts New Posts RSS Feed: Valid Configuration Exception thrown when trying to add User Controls at design time
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Valid Configuration Exception thrown when trying to add User Controls at design time

 Post Reply Post Reply
Author
TrevLeyb View Drop Down
Newbie
Newbie
Avatar

Joined: 28-Jun-2007
Location: New Zealand
Posts: 9
Post Options Post Options   Quote TrevLeyb Quote  Post ReplyReply Direct Link To This Post Topic: Valid Configuration Exception thrown when trying to add User Controls at design time
    Posted: 26-Aug-2007 at 1:43pm
Just a warning, I believe that if you host custom controls inside controls in forms, then the Design mode property of Visual Studio will incorrectly report that it is not in design mode when in fact it is.
 
A simple solution to this problem is to create a static class with a boolean flag for DesignMode which returns TRUE by default. Then, in the startup code (Main) set this to false.
 
We have definately had problems with C# whereby the DesignMode flag did not return true when in design mode. Lots of solutions were attempted, including rather complex scans of child objects checking if they might be in design mode, and we finally settled on the simple solution above.
 
Trevor
 
 
Originally posted by davidklitzke

The reason for this exception is that the Visual Studio Designer may blow up if it executes any PersistenceManager code while it is executing in Design Mode..  For example, we had a customer who received the same kind of error that you did,  We found that he was initializing the PersistenceManager in the Load Event of the User Control.  Here is what we told him to fix his problem:

We have resolved your problem.

You will need to change the load handler for your User Control.

Change this code:

  Private Sub UserControl_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        mPersMgr = PersistenceManager.DefaultManager

    End Sub 

To this: 

   Private Sub UserControl_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not Me.DesignMode Then

            mPersMgr = PersistenceManager.DefaultManager

        End If

    End Sub

 

Back to Top
vincentok View Drop Down
Newbie
Newbie
Avatar

Joined: 24-Aug-2007
Location: Ireland
Posts: 4
Post Options Post Options   Quote vincentok Quote  Post ReplyReply Direct Link To This Post Posted: 24-Aug-2007 at 7:06am
Hey David,

That was the problem alright.

Thanks for the swift and effective response. Your company and product continues to exceed my expectations every time.

Cheers,
Vincent
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 24-Aug-2007 at 5:13am

The reason for this exception is that the Visual Studio Designer may blow up if it executes any PersistenceManager code while it is executing in Design Mode..  For example, we had a customer who received the same kind of error that you did,  We found that he was initializing the PersistenceManager in the Load Event of the User Control.  Here is what we told him to fix his problem:

We have resolved your problem.

You will need to change the load handler for your User Control.

Change this code:

  Private Sub UserControl_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        mPersMgr = PersistenceManager.DefaultManager

    End Sub 

To this: 

   Private Sub UserControl_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not Me.DesignMode Then

            mPersMgr = PersistenceManager.DefaultManager

        End If

    End Sub

 

Back to Top
vincentok View Drop Down
Newbie
Newbie
Avatar

Joined: 24-Aug-2007
Location: Ireland
Posts: 4
Post Options Post Options   Quote vincentok Quote  Post ReplyReply Direct Link To This Post Posted: 24-Aug-2007 at 2:41am
Hi,

We're experiencing a problem with our application at the moment that is preventing us from adding user controls to our form at design time.

The user control can be added to the form programmatically without a problem. However, attempting to drop the user control onto a SplitContainer panel within the form results in the following message:

---------------------------
Microsoft Visual Studio
---------------------------
Failed to create component 'ClientSearchInput'.  The error message follows:
 
 'IdeaBlade.Util.IdeaBladeException: Unable to obtain a valid configuration file on IT-025.
 
Probing path:
1) File: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe.config - not found
2) File: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\MSTest.exe.config - not found
3) File: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PEVerify.exe.config - not found
4) File: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\VSTestHost.exe.config - not found
5) File: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\IdeaBlade.ibconfig - not found
6) Design-time execution detected - Will not probe for app.config or IdeaBlade.ibconfig in AppHelper
7) IdeaBlade.ibconfig fallthru - Default IdeaBlade.ibconfig used
8) Logging file:
 

   at IdeaBlade.Util.IdeaBladeConfig.AssertNonDefaultVersion()
 
   at IdeaBlade.Persistence.PersistenceManager..ctor(Boolean pShouldConnect, String pDataSourceExtension, PersistenceServiceOption pPersistenceServiceOption)
 
   at IdeaBlade.Persistence.P...'
---------------------------
OK  
---------------------------

The user control in question has two combo boxes which are populated by entities from the persistence manager. However, there are no specific Ideablade controls like the ControlBindingManager on the form.

Any ideas of what could be causing this? We're registered users of the product so I have no idea why it can't find the valid configuration file. And, more specifically, why it isn't looking for it in AppHelper where I believe it should be stored.

Thanks!


Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down