Skip to content

Unity.Configuration.UnityConfigurationSection is wrong? #18

Description

@273299007

I used Unity(5.10.2) and Unity.Configuration(5.10.0) .

I coppied the below setting to my app.config file(.net core2.0 console application) from https://github.com/unitycontainer/configuration/wiki/Format-of-the-Unity-Configuration-File

<section name="unity" type="Unity.Configuration.UnityConfigurationSection, Unity.Configuration"/>

1.I run the console application, and throw below exception at line of var section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");

System.Configuration.ConfigurationErrorsException HResult=0x80131902 Message=An error occurred creating the configuration section handler for unity: Could not load type 'Unity.Configuration.UnityConfigurationSection' from assembly 'Unity.Configuration'. (*****bin\Debug\netcoreapp2.0\***.dll.config line 4) Source=System.Configuration.ConfigurationManager 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.ConfigurationManager.GetSection(String sectionName)

2. After I changed the setting to below:
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection,Unity.Configuration"/>
below code will not throw above exception
var section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");

So the setting of "type" in section tag is wrong in
https://github.com/unitycontainer/configuration/wiki/Format-of-the-Unity-Configuration-File
?
Thank you so much!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancement 🔨Improvement of existing features

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions