In my code I need to recursively find a control on a page. For that I need to access the Controls property to get a list of all child controls. This works most of the time, but not when I reach ListSiteMapPath control. Accessing Controls property on this control results in an ConfigurationErrorsException with the following stack trace:
at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)
at System.Web.Configuration.ProvidersHelper.InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType)
at System.Web.Configuration.SiteMapSection.get_ProvidersInternal()
at System.Web.SiteMap.Initialize()
at System.Web.SiteMap.get_Providers()
at Microsoft.SharePoint.WebControls.ListSiteMapPath.CreateControlHierarchy()
at System.Web.UI.WebControls.SiteMapPath.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.WebControls.CompositeControl.get_Controls()
and a message of "Exception has been thrown by the target of an invocation. (C:\inetpub\wwwroot\wss\VirtualDirectories\80\web.config line 428)" which points to ExtendedSearchXmlContentMapProvider line. The other interesting thing is that when I
exclude SPXmlContentMapProvider, ExtendedSearchXmlContentMapProvider, AdministrationQuickLaunchProvider and SharedServicesQuickLaunchProvider I do not get the exception. The dll is being packaged as WebApplication (ie. not in GAC). Any ideas how to solve/work
around this issue without installing assemblies to GAC?