3 writes to _context
System.Xaml (3)
System\Xaml\InfosetObjects\XamlObjectWriter.cs (3)
100_context = new ObjectWriterContext(savedContext, settings, rootNameScope, runtime); 104_context = new ObjectWriterContext(schemaContext, settings, rootNameScope, runtime); 980_context = null;
195 references to _context
System.Xaml (195)
System\Xaml\InfosetObjects\XamlObjectWriter.cs (195)
105_context.AddNamespacePrefix(KnownStrings.XmlPrefix, XamlLanguage.Xml1998Namespace); 109throw _context.WithLineInfo(new XamlInternalException()); 112_context.IsInitializedCallback = this; 114_deferringWriter = new DeferringWriter(_context); 148Debug.Assert(_context.SourceBamlUri is null || _context.BaseUri is null || _context.SourceBamlUri == _context.BaseUri, 150_afterBeginInitHandler(this, new XamlObjectEventArgs(value, _context.BaseUri ?? _context.SourceBamlUri, _context.LineNumber_StartObject, _context.LinePosition_StartObject)); 235get { return _context.Runtime; } 265throw _context.WithLineInfo(new XamlObjectWriterException(err)); 268XamlMember parentProperty = (_context.CurrentType is null && _context.Depth > 1) 269? _context.ParentProperty 270: _context.CurrentProperty; // there is a push frame below making this the parent property. 273XamlType xamlType = (_context.CurrentType is null && _context.Depth > 1) 274? _context.ParentType 275: _context.CurrentType; 281throw _context.WithLineInfo(new XamlObjectWriterException(err)); 291if (_context.CurrentType is not null) 293_context.PushScope(); 296TryCreateParentInstance(_context); 298_context.CurrentIsObjectFromMember = true; 300object parentInstance = _context.ParentInstance; 301_context.CurrentType = parentProperty.Type; 304_context.CurrentInstance = inst ?? throw _context.WithLineInfo(new XamlObjectWriterException(SR.Format(SR.GetObjectNull, parentInstance.GetType(), parentProperty.Name))); 307_context.CurrentCollection = inst; 327_context.LineNumber_StartObject = _context.LineNumber; 328_context.LinePosition_StartObject = _context.LinePosition; 335throw _context.WithLineInfo(new XamlObjectWriterException(err)); 341throw _context.WithLineInfo(new XamlObjectWriterException(err)); 344if (_context.CurrentType is not null && _context.CurrentProperty is null) 347_context.CurrentType.ToString()); 348throw _context.WithLineInfo(new XamlObjectWriterException(err)); 358if (_context.CurrentType is not null) 360_context.PushScope(); 363_context.CurrentType = xamlType; 370if ((_context.LiveDepth == 1) && (_rootObjectInstance is not null)) 373if (!rootType.CanAssignTo(_context.CurrentType)) 379_context.CurrentInstance = _rootObjectInstance; 380if (_context.CurrentType.IsCollection || _context.CurrentType.IsDictionary) 382_context.CurrentCollection = _rootObjectInstance; 385Logic_BeginInit(_context); 400Debug.Assert(_context.CurrentProperty.DeferringLoader is not null); 402_context.PushScope(); 403_context.CurrentInstance = (XamlReader)templateList.GetReader(); 414throw _context.WithLineInfo(new XamlObjectWriterException(err)); 417if (_context.CurrentType is null) 420throw _context.WithLineInfo(new XamlObjectWriterException(err)); 423if (_context.CurrentProperty is not null) 425string err = SR.Format(SR.OpenPropertyInCurrentFrame_EO, _context.CurrentType.ToString(), 426_context.CurrentProperty.ToString()); 427throw _context.WithLineInfo(new XamlObjectWriterException(err)); 432Debug.Assert(_context.LiveDepth > 0); 433bool hasUnresolvedChildren = HasUnresolvedChildren(_context.CurrentInstance); 434bool isFixupToken = _context.CurrentInstance is NameFixupToken; 436if (!_context.CurrentIsObjectFromMember) 442if (_context.CurrentInstance is null) 444Logic_CreateAndAssignToParentStart(_context); 447XamlType xamlType = _context.CurrentType; 448object instance = _context.CurrentInstance; 451if (_context.CurrentType.IsMarkupExtension) 456Logic_DeferProvideValue(_context); 460ExecutePendingAdds(_context.CurrentType, _context.CurrentInstance); 461Logic_EndInit(_context); 462instance = _context.CurrentInstance; 463Logic_AssignProvidedValue(_context); 464if (_context.CurrentInstanceRegisteredName is not null) 469TriggerNameResolution(instance, _context.CurrentInstanceRegisteredName); 472_context.CurrentInstanceRegisteredName = null; 475instance = _context.CurrentInstance; 482if (_context.LiveDepth > 1) 484if (!_context.CurrentWasAssignedAtCreation) 486Logic_DoAssignmentToParentProperty(_context); 494if (_context.LiveDepth > 1) 496Logic_AddDependencyForUnresolvedChildren(_context, null); 501ExecutePendingAdds(_context.CurrentType, _context.CurrentInstance); 502Logic_EndInit(_context); 510Debug.Assert(_context.LiveDepth > 1); 511Logic_AddDependencyForUnresolvedChildren(_context, null); 515ExecutePendingAdds(_context.CurrentType, _context.CurrentInstance); 518if (_context.ParentIsPropertyValueSet) 520throw _context.WithLineInfo(new XamlDuplicateMemberException( 521_context.ParentProperty, 522_context.ParentType)); 526_lastInstance = _context.CurrentInstance; 527string name = _context.CurrentInstanceRegisteredName; 529if (_context.LiveDepth == 1) 531_rootNamescope = _context.RootNameScope; 537_context.PopScope(); 541_nameFixupGraph.IsOffTheStack(_lastInstance, name, _context.LineNumber, _context.LinePosition); 563if (_context.LiveDepth == 0 && !_inDispose) 566_context.RaiseNameScopeInitializationCompleteEvent(); 592err = SR.Format(SR.TypeHasNoContentProperty, _context.CurrentType); 598else if (_context.CurrentProperty is not null) 600err = SR.Format(SR.OpenPropertyInCurrentFrame_SM, _context.CurrentType.ToString(), 601_context.CurrentProperty.ToString(), 604else if (_context.CurrentType is null) 611throw _context.WithLineInfo(new XamlObjectWriterException(err)); 616Debug.Assert(_context.LiveDepth > 0); 617_context.CurrentProperty = property; 621Logic_DuplicatePropertyCheck(_context, property, onParent: false); 625if (_context.CurrentInstance is null) 627if (!IsConstructionDirective(_context.CurrentProperty) 628&& !IsDirectiveAllowedOnNullInstance(_context.CurrentProperty, _context.CurrentType)) 630Logic_CreateAndAssignToParentStart(_context); 637_context.CurrentCollection = new List<PositionalParameterDescriptor>(); 645throw _context.WithLineInfo(new XamlObjectWriterException(SR.Format(SR.LateConstructionDirective, property.Name))); 648if (_context.CurrentIsTypeConvertedObject) 654throw _context.WithLineInfo(new XamlObjectWriterException(SR.Format(SR.SettingPropertiesIsNotAllowed, property.Name))); 660if (property.IsAttachable && _context.CurrentInstance is NameFixupToken) 662NameFixupToken token = (NameFixupToken)_context.CurrentInstance; 663throw _context.WithLineInfo(new XamlObjectWriterException(SR.Format(SR.AttachedPropOnFwdRefTC, 664property, _context.CurrentType, string.Join(", ", token.NeededNames.ToArray())))); 679_context.CurrentCollection = Runtime.CreateInstance(property.Type, null); 701if (_context.CurrentType is null) 703property = _context.ParentProperty; 709property = _context.CurrentProperty; 714string err = (_context.CurrentType is not null) 715? SR.Format(SR.NoPropertyInCurrentFrame_EM, _context.CurrentType.ToString()) 718throw _context.WithLineInfo(new XamlObjectWriterException(err)); 730_context.CurrentCtorArgs = ((List<object>)_context.CurrentCollection).ToArray(); 734Logic_CreateFromInitializationValue(_context); 738_context.CurrentCollection = null; 742Logic_ConvertPositionalParamsToArgs(_context); 747if (_context.CurrentType is null) 749value = _context.CurrentInstance; 750_context.PopScope(); 753Logic_ValidateXClass(_context, value); 755else if (_context.CurrentType is null) 768object value = _context.CurrentInstance; 775_context.CurrentInstance = me; 779Logic_AssignProvidedValue(_context); 791if (property.IsDirective && property == XamlLanguage.Key && !Logic_ShouldConvertKey(_context)) 794_context.ParentKeyIsUnconverted = true; 798shouldSetValue = Logic_CreatePropertyValueFromValue(_context); 804_lastInstance = _context.CurrentInstance; 807Logic_DoAssignmentToParentProperty(_context); 810_context.PopScope(); // Value Node Scope 815_context.CurrentProperty = null; 816_context.CurrentIsPropertyValueSet = false; 831Debug.Assert(_context.CurrentProperty.DeferringLoader is not null); 833_context.PushScope(); 834_context.CurrentInstance = (XamlReader)templateList.GetReader(); 842XamlMember currentProperty = _context.CurrentProperty; 845string err = (_context.CurrentType is not null) 846? SR.Format(SR.NoPropertyInCurrentFrame_V, value, _context.CurrentType.ToString()) 849throw _context.WithLineInfo(new XamlObjectWriterException(err)); 855_context.PushScope(); 856_context.CurrentInstance = value; 877_context.CurrentType = XamlLanguage.PositionalParameterDescriptor; 878_context.CurrentInstance = new PositionalParameterDescriptor(value, true); 879Logic_DoAssignmentToParentCollection(_context); 880_context.PopScope(); 884_context.CurrentInstance = value; 885Logic_DoAssignmentToParentCollection(_context); 886_context.PopScope(); 919throw _context.WithLineInfo(new XamlObjectWriterException(err)); 922if (_context.CurrentType is not null && _context.CurrentProperty is null) 926_context.CurrentType.ToString()); 927throw _context.WithLineInfo(new XamlObjectWriterException(err)); 931if (_context.CurrentType is not null) 933_context.PushScope(); 936_context.AddNamespacePrefix(namespaceDeclaration.Prefix, namespaceDeclaration.Namespace); 942while (_context.LiveDepth > 0) 944_context.PopScope(); 950_context.PushScope(); 960bool seenStartObject = _context.LiveDepth > 1 || _context.CurrentType is not null; 963while (_context.LiveDepth > 0) 965if (_context.CurrentProperty is not null) 1009return _context.RootNameScope; 1030return _context.SchemaContext; 1039_context.LineNumber = lineNumber; 1040_context.LinePosition = linePosition; 1062return _context.WithLineInfo(ex); 2412!_context.IsOnTheLiveStack(token.TargetContext.CurrentInstance)) 2444if (_context.LiveDepth > 0) 2447if (_context.IsOnTheLiveStack(instance))