Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom ConfigurationSection type not loading correctly

Every time I do a ConfigurationManager.GetSection("registeredPlugIns") for this custom section I receive this error:

An error occurred creating the configuration section handler for registeredPlugIns:

Could not load type 'Engine.PlugInArch.PlugInConfigurationSection' from assembly 'System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Why is it trying to load the type from System.Configuration and not the assembly that I ask it to?

Here is my Section code:

namespace Engine.PlugInArch
{
    public class PlugInConfigurationSection : ConfigurationSection
    {
        [ConfigurationProperty("plugIns", IsDefaultCollection = false),
         ConfigurationCollection(typeof(PlugInCollection), AddItemName = "addPlugin")]
        public PlugInCollection PlugIns
        {
            get { return this["plugIns"] as PlugInCollection; }
        }

    }
}

And here is my app.config

<configuration>
    <configSections>
    <section name="registeredPlugIns" type="Engine.PlugInArch.PlugInConfigurationSection, Engine"/>
    </configSections>
        ...
    <registeredPlugIns>
       <plugIns>
           <addPlugIn DllName="ProcessorPlugin.dll"/>
       </plugIns>
     </registeredPlugIns>

</configuration>
like image 626
Ryan Bennett Avatar asked Nov 24 '10 16:11

Ryan Bennett


1 Answers

Is your dll called Engine.dll? I think not and that is where the problem is.

OK, run procmon from sysinternals. Set the filter to your process name and also filter for result="NAME NOT FOUND". You will see entries where it is looking for Engine.dll or Engine.exe. See where it is looking for it and it is likely the file needs to be copied to the running folder.

like image 103
Aliostad Avatar answered Oct 01 '22 23:10

Aliostad