Skip to content
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

Config pragma clear{} still tries to join section by name in spite of the fact that they have been deleted by "clear" #937

Open
itadapter opened this issue Jan 14, 2025 · 1 comment
Assignees
Labels
AREA-CONFIG Configuration bug Something isn't working

Comments

@itadapter
Copy link
Contributor

itadapter commented Jan 14, 2025

using System;
using Azos;
using Azos.Conf;
					
public class Program
{
	public static void Main()
	{
		var cfg1 = @"
  conf  
  {
    //////_override=replace
    caption{ eng{n='Window' d='Window'} }

    crel{ name='comp.mnic@g8corp::CO-PATIO'}
    crel{ name='comp.mnic@g8corp::CO-CHAMP'}
    crel{ name='comp.mnic@g8corp::CO-STNK'}
    crel{ name='comp.mnic@g8corp::CO-UWD'}
    crel{ name='comp.mnic@g8corp::CO-BTHA'}
    crel{ name='comp.mnic@g8corp::CO-APEX'}
    crel{ name='comp.mnic@g8corp::CO-YHIC'}
    crel{ name='comp.mnic@g8corp::CO-KD'}
    ////crel{ name='comp.mnic@g8corp::CO-HPA'} 


    class{ name='Windows' class-type='WM1'}
    class{ name='ReplacementWindows' class-type='WM1'}
    class{ name='CustomShapeWindows' class-type='M1'}
    class{ name='PatioDoors' class-type='WM1'}
    class{ name='SlidingDoors' class-type='WM1'}
  }".AsLaconicConfig(handling: Azos.Data.ConvertErrorHandling.Throw);
		
		var cfg2 = @"conf 
    {
	  _clear{} // clear all inherited attributes and sections from parent

      caption{ eng{n='Window Coverings' d='Window Blinds and Shades'} }

      crel{ name='comp.mnic@g8corp::CO-PATIO'} 

      class{ name='Blinds'       class-type='WM1'}
      class{ name='Shades'       class-type='WM1'}
    }
		".AsLaconicConfig(handling: Azos.Data.ConvertErrorHandling.Throw);
		
		cfg1.OverrideBy(cfg2);
	
		Console.WriteLine("Hello World: {0}", cfg1.ToLaconicString());
	}
}
@itadapter itadapter self-assigned this Jan 14, 2025
@itadapter itadapter added bug Something isn't working AREA-CONFIG Configuration labels Jan 14, 2025
@itadapter itadapter changed the title NUll Reference exception from the code below in C#Fiddl Config pragma clear{} stil tries to join section by name in spite of the fact that they have been deleted by "clear" Jan 14, 2025
@itadapter itadapter changed the title Config pragma clear{} stil tries to join section by name in spite of the fact that they have been deleted by "clear" Config pragma clear{} still tries to join section by name in spite of the fact that they have been deleted by "clear" Jan 14, 2025
@itadapter
Copy link
Contributor Author

It is under ConfigNode.MergeSections()

  var children = Children;//thread safe  //<==== THIS SHOULD be AFTER delete all children below
  var osects = other.Children;//thread safe
  var clear = other[rules.SectionClearName].Exists;
  if (clear) DeleteAllChildren(); 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AREA-CONFIG Configuration bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant