Print Page | Close Window

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

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=381
Printed Date: 11-Jun-2026 at 10:35pm


Topic: Valid Configuration Exception thrown when trying to add User Controls at design time
Posted By: vincentok
Subject: Valid Configuration Exception thrown when trying to add User Controls at design time
Date 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!





Replies:
Posted By: davidklitzke
Date 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

 



Posted By: vincentok
Date 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


Posted By: TrevLeyb
Date 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

 




Print Page | Close Window