Skip to content

ConsoleSection class is not defined in the code #2418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jack147527 opened this issue May 8, 2019 · 1 comment
Open

ConsoleSection class is not defined in the code #2418

jack147527 opened this issue May 8, 2019 · 1 comment
Labels
area-System.Configuration Pri3 Indicates issues/PRs that are low priority
Milestone

Comments

@jack147527
Copy link

jack147527 commented May 8, 2019

There is a code missing issue in ConfigurationManager.OpenExeConfiguration Method.

ConsoleSection currentSection = null;

I think ConsoleSection class should be defined in the code. otherwise we could not run the GetRoamingConfiguration method.

@dotnet-bot dotnet-bot added the untriaged New issue has not been triaged by the area owner label May 8, 2019
@rpetrusha rpetrusha self-assigned this May 10, 2019
@rpetrusha rpetrusha added 📁 Repo - samples and removed untriaged New issue has not been triaged by the area owner labels May 10, 2019
@rpetrusha rpetrusha added this to the June 2019 milestone May 10, 2019
@rpetrusha
Copy link

Thanks for pointing this out, @jack147527. The source code is incomplete in many instances here, unfortunately. We'll schedule some time to work on presenting compilable source in an uncoming sprint.

In the meantime, you'll need two additional classes to compile the example. The first is ConsoleSection:

  public class ConsoleSection : ConfigurationSection
  {
    // Create a configuration section.
    public ConsoleSection()
    { }

    // Set or get the ConsoleElement. 
    [ConfigurationProperty("consoleElement")]
    public ConsoleConfigElement ConsoleElement
    {
      get
      {
        return (
          (ConsoleConfigElement) this["consoleElement"]);
      }
      set
      {
        this["consoleElement"] = value;
      }
    }
  }

The second is ConsoleConfigElement:

  public class ConsoleConfigElement : ConfigurationElement
  {
    // Create the element.
    public ConsoleConfigElement()
    { }
   
    // Create the element.
    public ConsoleConfigElement(ConsoleColor fColor, 
        ConsoleColor bColor)
    {
      ForegroundColor = fColor;
      BackgroundColor = bColor;
    }

    // Get or set the console background color.
    [ConfigurationProperty("background",
      DefaultValue = ConsoleColor.Black,
      IsRequired = false)]
    public ConsoleColor BackgroundColor
    {
      get
      {
        return (ConsoleColor)this["background"];
      }
      set
      {
        this["background"] = value;
      }
    }

    // Get or set the console foreground color.
    [ConfigurationProperty("foreground",
       DefaultValue = ConsoleColor.White,
       IsRequired = false)]
    public ConsoleColor ForegroundColor
    {
      get
      {
        return (ConsoleColor)this["foreground"];
      }
      set
      {
        this["foreground"] = value;
      }
    }
  }

@rpetrusha rpetrusha modified the milestones: June 2019, July 2019 Jul 1, 2019
@rpetrusha rpetrusha modified the milestones: July 2019, August 2019 Jul 26, 2019
@rpetrusha rpetrusha modified the milestones: August 2019, October 2019 Sep 9, 2019
@rpetrusha rpetrusha removed their assignment Oct 8, 2019
@rpetrusha rpetrusha modified the milestones: October 2019, Backlog Oct 8, 2019
@PRMerger13 PRMerger13 added the Pri3 Indicates issues/PRs that are low priority label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Configuration Pri3 Indicates issues/PRs that are low priority
Projects
None yet
Development

No branches or pull requests

6 participants