i am trying to set up a test project for my site, especially for my search request on examine index. The index in working well in the umbraco site but not in my test project.
This is my code which is causing the exception:
var index = ExamineManager.Instance.SearchProviderCollection["ApartmentCatalogIndexer"];
This is the following exception/stacktrace:
System.Configuration.ConfigurationErrorsException : Exception has been thrown by the target of an invocation. (C:\Users\Thobi\AppData\Local\Temp\c23yba53.cr1\config\ExamineSettings.config line 12)
----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
----> System.NullReferenceException : Object reference not set to an instance of an object.
at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)
at System.Web.Configuration.ProvidersHelper.InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType)
at Examine.ExamineManager.EnsureProviders() in x:\Projects\Examine\Examine\Projects\Examine\ExamineManager.cs:line 98
at Examine.ExamineManager.getSearchProviderCollection() in x:\Projects\Examine\Examine\Projects\Examine\ExamineManager.cs:line 60
at UmbracoProject.WebsiteTest.UnitTests.Website.Index.IndexSearchTest.IndexSearchTestSearchRegionWithSpecialCharacters() in c:\Users\Thobi\Repository\UmbracoProject\UmbracoProject.WebsiteTest\UnitTests\Website\Index\IndexSearchTest.cs:line 26
--TargetInvocationException
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at System.Web.HttpRuntime.CreatePublicInstance(Type type)
at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)
--NullReferenceException
at UmbracoExamine.UmbracoContentIndexer..ctor()
The config files seems to be okay for me and i also copied the existing index to the debug output folder.
<?xml version="1.0"?>
<!--
Umbraco examine is an extensible indexer and search engine.
This configuration file can be extended to create your own index sets.
Index/Search providers can be defined in the UmbracoSettings.config
More information and documentation can be found on CodePlex: http://umbracoexamine.codeplex.com
-->
<ExamineLuceneIndexSets>
<!-- The internal index set used by Umbraco back-office - DO NOT REMOVE -->
<IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/"/>
<!-- The internal index set used by Umbraco back-office for indexing members - DO NOT REMOVE -->
<IndexSet SetName="InternalMemberIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/InternalMember/">
<IndexAttributeFields>
<add Name="id" />
<add Name="nodeName"/>
<add Name="updateDate" />
<add Name="writerName" />
<add Name="loginName" />
<add Name="email" />
<add Name="nodeTypeAlias" />
</IndexAttributeFields>
</IndexSet>
<!-- Default Indexset for external searches, this indexes all fields on all types of nodes-->
<IndexSet SetName="ExternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/External/" />
<IndexSet SetName="ApartmentCatalog" IndexPath="~/App_Data/TEMP/ExamineIndexes/ApartmentCatalog/">
<IndexAttributeFields>
<add Name="id" />
<add Name="updateDate" />
<add Name="writerName" />
<add Name="path" />
<add Name="nodeTypeAlias" />
<add Name="parentID" />
</IndexAttributeFields>
<IndexUserFields>
<add Name="providerId"/>
<add Name="title"/>
</IndexUserFields>
<IncludeNodeTypes>
<add Name="Apartment"/>
</IncludeNodeTypes>
<ExcludeNodeTypes>
</ExcludeNodeTypes>
</IndexSet>
</ExamineLuceneIndexSets>
For me its looking fine, do you see something wrong?
The config files are located at the /debug/config folder in the test procect. Maybe the location is the problem? But while running the config files are copied to the temp folder.
Hi there, Can you please explain further about how you fixed this issue? I have the same error and struggling to fix that yet.
My error message is as follows
Message:
System.Configuration.ConfigurationErrorsException : Exception has been thrown by the target of an invocation. (C:\Users\inoshika.fernando\source\trn-umbraco\NZME.Tests\bin\Debug\config\ExamineSettings.config line 12)
----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
----> System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
at ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)
at ProvidersHelper.InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType)
at ExamineManager.EnsureProviders() in ExamineManager.cs line: 111
at ExamineManager.getSearchProviderCollection() in ExamineManager.cs line: 75
at ExamineSingleBackgroundWingsStrategyTest.ExamineShouldreturnSameBackgroundWings_Model(String image) in ExamineSingleBackgroundWingsStrategyTest.cs line: 43
at --TargetInvocationException
at RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at Activator.CreateInstance(Type type, Boolean nonPublic)
at Activator.CreateInstance(Type type)
at HttpRuntime.CreatePublicInstanceByWebObjectActivator(Type type)
at ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)
at --NullReferenceException
at UmbracoContentIndexer.ctor()
Examine Search Provider in Test Environment
Hey @all,
i am trying to set up a test project for my site, especially for my search request on examine index. The index in working well in the umbraco site but not in my test project.
This is my code which is causing the exception:
This is the following exception/stacktrace:
System.Configuration.ConfigurationErrorsException : Exception has been thrown by the target of an invocation. (C:\Users\Thobi\AppData\Local\Temp\c23yba53.cr1\config\ExamineSettings.config line 12) ----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation. ----> System.NullReferenceException : Object reference not set to an instance of an object.
at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) at System.Web.Configuration.ProvidersHelper.InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType) at Examine.ExamineManager.EnsureProviders() in x:\Projects\Examine\Examine\Projects\Examine\ExamineManager.cs:line 98 at Examine.ExamineManager.getSearchProviderCollection() in x:\Projects\Examine\Examine\Projects\Examine\ExamineManager.cs:line 60 at UmbracoProject.WebsiteTest.UnitTests.Website.Index.IndexSearchTest.IndexSearchTestSearchRegionWithSpecialCharacters() in c:\Users\Thobi\Repository\UmbracoProject\UmbracoProject.WebsiteTest\UnitTests\Website\Index\IndexSearchTest.cs:line 26 --TargetInvocationException at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at System.Web.HttpRuntime.CreatePublicInstance(Type type) at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) --NullReferenceException at UmbracoExamine.UmbracoContentIndexer..ctor()
The config files seems to be okay for me and i also copied the existing index to the debug output folder.
Has anyone an idea, whats wrong?
Hello Thobias
Can i see your Examine configs i believe that the culparete :)
ExamineSettings.config
ExamineIndex.config
For me its looking fine, do you see something wrong?
The config files are located at the /debug/config folder in the test procect. Maybe the location is the problem? But while running the config files are copied to the temp folder.
Thanks for your help.
Update:
This is a Examine issue. The AppDomainAppId is not null checked. In case that its a class library for unit testing, the AppDomainAppId is null.
We can close this ticket.
Hi there, Can you please explain further about how you fixed this issue? I have the same error and struggling to fix that yet. My error message is as follows
Message: System.Configuration.ConfigurationErrorsException : Exception has been thrown by the target of an invocation. (C:\Users\inoshika.fernando\source\trn-umbraco\NZME.Tests\bin\Debug\config\ExamineSettings.config line 12) ----> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation. ----> System.NullReferenceException : Object reference not set to an instance of an object. Stack Trace: at ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) at ProvidersHelper.InstantiateProviders(ProviderSettingsCollection configProviders, ProviderCollection providers, Type providerType) at ExamineManager.EnsureProviders() in ExamineManager.cs line: 111 at ExamineManager.getSearchProviderCollection() in ExamineManager.cs line: 75 at ExamineSingleBackgroundWingsStrategyTest.ExamineShouldreturnSameBackgroundWings_Model(String image) in ExamineSingleBackgroundWingsStrategyTest.cs line: 43 at --TargetInvocationException at RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at Activator.CreateInstance(Type type, Boolean nonPublic) at Activator.CreateInstance(Type type) at HttpRuntime.CreatePublicInstanceByWebObjectActivator(Type type) at ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType) at --NullReferenceException at UmbracoContentIndexer.ctor()
Many thanks...
is working on a reply...