3 writes to _context
System.Xaml (3)
System\Xaml\InfosetObjects\XamlObjectWriter.cs (3)
101_context = new ObjectWriterContext(savedContext, settings, rootNameScope, runtime); 105_context = new ObjectWriterContext(schemaContext, settings, rootNameScope, runtime); 981_context = null;
195 references to _context
System.Xaml (195)
System\Xaml\InfosetObjects\XamlObjectWriter.cs (195)
106_context.AddNamespacePrefix(KnownStrings.XmlPrefix, XamlLanguage.Xml1998Namespace); 110throw _context.WithLineInfo(new XamlInternalException()); 113_context.IsInitializedCallback = this; 115_deferringWriter = new DeferringWriter(_context); 149Debug.Assert(_context.SourceBamlUri is null || _context.BaseUri is null || _context.SourceBamlUri == _context.BaseUri, 151_afterBeginInitHandler(this, new XamlObjectEventArgs(value, _context.BaseUri ?? _context.SourceBamlUri, _context.LineNumber_StartObject, _context.LinePosition_StartObject)); 236get { return _context.Runtime; } 266throw _context.WithLineInfo(new XamlObjectWriterException(err)); 269XamlMember parentProperty = (_context.CurrentType is null && _context.Depth > 1) 270? _context.ParentProperty 271: _context.CurrentProperty; // there is a push frame below making this the parent property. 274XamlType xamlType = (_context.CurrentType is null && _context.Depth > 1) 275? _context.ParentType 276: _context.CurrentType; 282throw _context.WithLineInfo(new XamlObjectWriterException(err)); 292if (_context.CurrentType is not null) 294_context.PushScope(); 297TryCreateParentInstance(_context); 299_context.CurrentIsObjectFromMember = true; 301object parentInstance = _context.ParentInstance; 302_context.CurrentType = parentProperty.Type; 305_context.CurrentInstance = inst ?? throw _context.WithLineInfo(new XamlObjectWriterException(SR.Format(SR.GetObjectNull, parentInstance.GetType(), parentProperty.Name))); 308_context.CurrentCollection = inst; 328_context.LineNumber_StartObject = _context.LineNumber; 329_context.LinePosition_StartObject = _context.LinePosition; 336throw _context.WithLineInfo(new XamlObjectWriterException(err)); 342throw _context.WithLineInfo(new XamlObjectWriterException(err)); 345if (_context.CurrentType is not null && _context.CurrentProperty is null) 348_context.CurrentType.ToString()); 349throw _context.WithLineInfo(new XamlObjectWriterException(err)); 359if (_context.CurrentType is not null) 361_context.PushScope(); 364_context.CurrentType = xamlType; 371if ((_context.LiveDepth == 1) && (_rootObjectInstance is not null)) 374if (!rootType.CanAssignTo(_context.CurrentType)) 380_context.CurrentInstance = _rootObjectInstance; 381if (_context.CurrentType.IsCollection || _context.CurrentType.IsDictionary) 383_context.CurrentCollection = _rootObjectInstance; 386Logic_BeginInit(_context); 401Debug.Assert(_context.CurrentProperty.DeferringLoader is not null); 403_context.PushScope(); 404_context.CurrentInstance = (XamlReader)templateList.GetReader(); 415throw _context.WithLineInfo(new XamlObjectWriterException(err)); 418if (_context.CurrentType is null) 421throw _context.WithLineInfo(new XamlObjectWriterException(err)); 424if (_context.CurrentProperty is not null) 426string err = SR.Format(SR.OpenPropertyInCurrentFrame_EO, _context.CurrentType.ToString(), 427_context.CurrentProperty.ToString()); 428throw _context.WithLineInfo(new XamlObjectWriterException(err)); 433Debug.Assert(_context.LiveDepth > 0); 434bool hasUnresolvedChildren = HasUnresolvedChildren(_context.CurrentInstance); 435bool isFixupToken = _context.CurrentInstance is NameFixupToken; 437if (!_context.CurrentIsObjectFromMember) 443if (_context.CurrentInstance is null) 445Logic_CreateAndAssignToParentStart(_context); 448XamlType xamlType = _context.CurrentType; 449object instance = _context.CurrentInstance; 452if (_context.CurrentType.IsMarkupExtension) 457Logic_DeferProvideValue(_context); 461ExecutePendingAdds(_context.CurrentType, _context.CurrentInstance); 462Logic_EndInit(_context); 463instance = _context.CurrentInstance; 464Logic_AssignProvidedValue(_context); 465if (_context.CurrentInstanceRegisteredName is not null) 470TriggerNameResolution(instance, _context.CurrentInstanceRegisteredName); 473_context.CurrentInstanceRegisteredName = null; 476instance = _context.CurrentInstance; 483if (_context.LiveDepth > 1) 485if (!_context.CurrentWasAssignedAtCreation) 487Logic_DoAssignmentToParentProperty(_context); 495if (_context.LiveDepth > 1) 497Logic_AddDependencyForUnresolvedChildren(_context, null); 502ExecutePendingAdds(_context.CurrentType, _context.CurrentInstance); 503Logic_EndInit(_context); 511Debug.Assert(_context.LiveDepth > 1); 512Logic_AddDependencyForUnresolvedChildren(_context, null); 516ExecutePendingAdds(_context.CurrentType, _context.CurrentInstance); 519if (_context.ParentIsPropertyValueSet) 521throw _context.WithLineInfo(new XamlDuplicateMemberException( 522_context.ParentProperty, 523_context.ParentType)); 527_lastInstance = _context.CurrentInstance; 528string name = _context.CurrentInstanceRegisteredName; 530if (_context.LiveDepth == 1) 532_rootNamescope = _context.RootNameScope; 538_context.PopScope(); 542_nameFixupGraph.IsOffTheStack(_lastInstance, name, _context.LineNumber, _context.LinePosition); 564if (_context.LiveDepth == 0 && !_inDispose) 567_context.RaiseNameScopeInitializationCompleteEvent(); 593err = SR.Format(SR.TypeHasNoContentProperty, _context.CurrentType); 599else if (_context.CurrentProperty is not null) 601err = SR.Format(SR.OpenPropertyInCurrentFrame_SM, _context.CurrentType.ToString(), 602_context.CurrentProperty.ToString(), 605else if (_context.CurrentType is null) 612throw _context.WithLineInfo(new XamlObjectWriterException(err)); 617Debug.Assert(_context.LiveDepth > 0); 618_context.CurrentProperty = property; 622Logic_DuplicatePropertyCheck(_context, property, onParent: false); 626if (_context.CurrentInstance is null) 628if (!IsConstructionDirective(_context.CurrentProperty) 629&& !IsDirectiveAllowedOnNullInstance(_context.CurrentProperty, _context.CurrentType)) 631Logic_CreateAndAssignToParentStart(_context); 638_context.CurrentCollection = new List<PositionalParameterDescriptor>(); 646throw _context.WithLineInfo(new XamlObjectWriterException(SR.Format(SR.LateConstructionDirective, property.Name))); 649if (_context.CurrentIsTypeConvertedObject) 655throw _context.WithLineInfo(new XamlObjectWriterException(SR.Format(SR.SettingPropertiesIsNotAllowed, property.Name))); 661if (property.IsAttachable && _context.CurrentInstance is NameFixupToken) 663NameFixupToken token = (NameFixupToken)_context.CurrentInstance; 664throw _context.WithLineInfo(new XamlObjectWriterException(SR.Format(SR.AttachedPropOnFwdRefTC, 665property, _context.CurrentType, string.Join(", ", token.NeededNames.ToArray())))); 680_context.CurrentCollection = Runtime.CreateInstance(property.Type, null); 702if (_context.CurrentType is null) 704property = _context.ParentProperty; 710property = _context.CurrentProperty; 715string err = (_context.CurrentType is not null) 716? SR.Format(SR.NoPropertyInCurrentFrame_EM, _context.CurrentType.ToString()) 719throw _context.WithLineInfo(new XamlObjectWriterException(err)); 731_context.CurrentCtorArgs = ((List<object>)_context.CurrentCollection).ToArray(); 735Logic_CreateFromInitializationValue(_context); 739_context.CurrentCollection = null; 743Logic_ConvertPositionalParamsToArgs(_context); 748if (_context.CurrentType is null) 750value = _context.CurrentInstance; 751_context.PopScope(); 754Logic_ValidateXClass(_context, value); 756else if (_context.CurrentType is null) 769object value = _context.CurrentInstance; 776_context.CurrentInstance = me; 780Logic_AssignProvidedValue(_context); 792if (property.IsDirective && property == XamlLanguage.Key && !Logic_ShouldConvertKey(_context)) 795_context.ParentKeyIsUnconverted = true; 799shouldSetValue = Logic_CreatePropertyValueFromValue(_context); 805_lastInstance = _context.CurrentInstance; 808Logic_DoAssignmentToParentProperty(_context); 811_context.PopScope(); // Value Node Scope 816_context.CurrentProperty = null; 817_context.CurrentIsPropertyValueSet = false; 832Debug.Assert(_context.CurrentProperty.DeferringLoader is not null); 834_context.PushScope(); 835_context.CurrentInstance = (XamlReader)templateList.GetReader(); 843XamlMember currentProperty = _context.CurrentProperty; 846string err = (_context.CurrentType is not null) 847? SR.Format(SR.NoPropertyInCurrentFrame_V, value, _context.CurrentType.ToString()) 850throw _context.WithLineInfo(new XamlObjectWriterException(err)); 856_context.PushScope(); 857_context.CurrentInstance = value; 878_context.CurrentType = XamlLanguage.PositionalParameterDescriptor; 879_context.CurrentInstance = new PositionalParameterDescriptor(value, true); 880Logic_DoAssignmentToParentCollection(_context); 881_context.PopScope(); 885_context.CurrentInstance = value; 886Logic_DoAssignmentToParentCollection(_context); 887_context.PopScope(); 920throw _context.WithLineInfo(new XamlObjectWriterException(err)); 923if (_context.CurrentType is not null && _context.CurrentProperty is null) 927_context.CurrentType.ToString()); 928throw _context.WithLineInfo(new XamlObjectWriterException(err)); 932if (_context.CurrentType is not null) 934_context.PushScope(); 937_context.AddNamespacePrefix(namespaceDeclaration.Prefix, namespaceDeclaration.Namespace); 943while (_context.LiveDepth > 0) 945_context.PopScope(); 951_context.PushScope(); 961bool seenStartObject = _context.LiveDepth > 1 || _context.CurrentType is not null; 964while (_context.LiveDepth > 0) 966if (_context.CurrentProperty is not null) 1010return _context.RootNameScope; 1031return _context.SchemaContext; 1040_context.LineNumber = lineNumber; 1041_context.LinePosition = linePosition; 1063return _context.WithLineInfo(ex); 2413!_context.IsOnTheLiveStack(token.TargetContext.CurrentInstance)) 2445if (_context.LiveDepth > 0) 2448if (_context.IsOnTheLiveStack(instance))