I\'ve been searching the past few days trying to get an error fixed in a WPF application using Prism, but haven\'t had any luck and thought I\'d see if Stackoverflow had any
Add reference Microsoft.Practices.ServiceLocation to your Test Project to resolve this issue.
I had the same exception (Prism 5.0) and my solution was to set the type of the config section to Microsoft.Practices.Prism.Composition instead of Microsoft.Practices.Prism which I found in many examples.
The solution ended up being simple, as these things often are... I hadn't changed my App.config file's Build Action to "Resource" (can be found by clicking on the App.config file and looking at the properties section).
I've encountered similar issue last time. My solution was different and very specific but error was same. If you are sending you binaries and target PC uses Windows 10 make sure that you unblock all files.
StackTrace: at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey) at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at Microsoft.Practices.Prism.Modularity.ConfigurationStore.RetrieveModuleConfigurationSection() at
The call stack itself indicates that Prism is already loaded, but when it tries to parse the .config file, an exception happens in RetrieveModuleConfigurationSection
.
You might start from there to check what might be the cause.
In the newer versions of Prism (I'm using 6.3.0), the ModulesConfigurationSection
class is in Prism.Wpf.dll
.
Change your configuration to this:
<configSections>
<section name="modules" type="Prism.Modularity.ModulesConfigurationSection, Prism.Wpf"/>
</configSections>