Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3319794
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:52:00+00:00 2026-05-17T22:52:00+00:00

I have a custom configuration section and i want to generate an xsd scheme

  • 0

I have a custom configuration section and i want to generate an xsd scheme using the xsd tool, however i get the following error :

Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation. All rights reserved.
Error: There was an error processing 'C:\Development\XXX Application Framewo
rk\XXX.AppFramework\bin\Debug\XXX.AppFramework.dll'.
- There was an error reflecting type 'XXX.AppFramework.Configuration.AppFr
ameworkEnvironmentConfiguration'.
- You must implement a default accessor on System.Configuration.ConfigurationL
ockCollection because it inherits from ICollection.

However i do not implement ICollection on my section, it looks like this :

public class AppFrameworkEnvironmentConfiguration : ConfigurationElement
{
    [ConfigurationProperty("Name")]
    public string Name
    {
        get { return (string)this["Name"]; }
        set { this["Name"] = value; }
    }

    [ConfigurationProperty("Description")]
    public string Description
    {
        get { return (string)this["Description"]; }
        set { this["Description"] = value; }
    }

    [ConfigurationProperty("ApplicationName")]
    public string ApplicationName
    {
        get { return (string)this["ApplicationName"]; }
        set { this["ApplicationName"] = value; }
    }

    [ConfigurationProperty("DeploymentMode",DefaultValue=DeploymentMode.Local)]
    public DeploymentMode DeploymentMode
    {
        get { return (DeploymentMode)this["DeploymentMode"]; }
        set { this["DeploymentMode"] = value; }
    }


}

It doesnt look like ConfigurationElement implements ICollection so im not sure why i am getting this error ?

Having had a deep look through reflector to find when this error is thrown, im even more perplexed, first off my little test does indeed evaluate to false :

bool test = typeof(ICollection).IsAssignableFrom(typeof    (XXX.AppFramework.Configuration.AppFrameworkEnvironmentConfiguration));

In reflector the only place i can find it raise that exception is wrapped in this exact test, i have found it in System.Xml.Reflection.TypeScope.ImportTypeDesc and looks like this :

else if (typeof(ICollection).IsAssignableFrom(type))
{
    root = TypeKind.Collection;
    elementType = GetCollectionElementType(type, (memberInfo == null) ? null : (memberInfo.DeclaringType.FullName + "." + memberInfo.Name));
    none |= GetConstructorFlags(type, ref exception);
}

and then

private static Type GetCollectionElementType(Type type, string memberInfo)
{
return GetDefaultIndexer(type, memberInfo).PropertyType;
}

which calls

internal static PropertyInfo GetDefaultIndexer(Type type, string memberInfo)
{
if (typeof(IDictionary).IsAssignableFrom(type))
{
    if (memberInfo == null)
    {
        throw new NotSupportedException(Res.GetString("XmlUnsupportedIDictionary",     new     object[] { type.FullName }));
    }
    throw new NotSupportedException(Res.GetString("XmlUnsupportedIDictionaryDetails", new object[] { memberInfo, type.FullName }));
}
MemberInfo[] defaultMembers = type.GetDefaultMembers();
PropertyInfo info = null;
if ((defaultMembers != null) && (defaultMembers.Length > 0))
{
    for (Type type2 = type; type2 != null; type2 = type2.BaseType)
    {
        for (int i = 0; i < defaultMembers.Length; i++)
        {
            if (defaultMembers[i] is PropertyInfo)
            {
                PropertyInfo info2 = (PropertyInfo) defaultMembers[i];
                if ((info2.DeclaringType == type2) && info2.CanRead)
                {
                    ParameterInfo[] parameters = info2.GetGetMethod().GetParameters();
                    if ((parameters.Length == 1) && (parameters[0].ParameterType == typeof(int)))
                    {
                        info = info2;
                        break;
                    }
                }
            }
        }
        if (info != null)
        {
            break;
        }
    }
}
if (info == null)
{
    throw new InvalidOperationException(Res.GetString("XmlNoDefaultAccessors", new object[] { type.FullName })); **< HERE IS THE ERROR**
}
if (type.GetMethod("Add", new Type[] { info.PropertyType }) == null)
{
    throw new InvalidOperationException(Res.GetString("XmlNoAddMethod", new object[] { type.FullName, info.PropertyType, "ICollection" }));
}
return info;
}

I also tried adding a default parameterless constructor, no different ;-(
Any ideas ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:52:01+00:00Added an answer on May 17, 2026 at 10:52 pm

    Can you try adding a default constructor, I have seen similar issues like this and adding an empty default constructor has fixed this for me in the past. Not sure why, but have been meaning to research it at some point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom configuration section registered in the app/web.config, let's call it MySection
I have just rolled a custom configuration section, created an accompanying schema document for
I have custom configuration section within web.config file. I'm lingering between: Reading it into
I have the following code var section = new CustomConfigurationSection(); section.SectionInformation.Type = System.Configuration.NameValueFileSectionHandler; section.SectionInformation.SetRawXml(sectionXml);
I'm having difficulties reading an app.config using the ConfigurationManager. I have a custom section,
I have a web application with a custom configuration section. That section contains information
I have the following problem trying to use a custom config section in my
I have created a custom configuration section in a c# class library by inheriting
I have defined a custom section in the App.config file and all the Configuration
I have a windows service that has a custom configuration section. In the configSectionHandler

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.