3 writes to _context
System.Xaml (3)
System\Xaml\InfosetObjects\XamlObjectWriter.cs (3)
104
_context
= new ObjectWriterContext(savedContext, settings, rootNameScope, runtime);
108
_context
= new ObjectWriterContext(schemaContext, settings, rootNameScope, runtime);
960
_context
= null;
195 references to _context
System.Xaml (195)
System\Xaml\InfosetObjects\XamlObjectWriter.cs (195)
109
_context
.AddNamespacePrefix(KnownStrings.XmlPrefix, XamlLanguage.Xml1998Namespace);
113
throw
_context
.WithLineInfo(new XamlInternalException());
115
_context
.IsInitializedCallback = this;
117
_deferringWriter = new DeferringWriter(
_context
);
151
Debug.Assert(
_context
.SourceBamlUri == null ||
_context
.BaseUri == null ||
_context
.SourceBamlUri ==
_context
.BaseUri,
153
_afterBeginInitHandler(this, new XamlObjectEventArgs(value,
_context
.BaseUri ??
_context
.SourceBamlUri,
_context
.LineNumber_StartObject,
_context
.LinePosition_StartObject));
237
get { return
_context
.Runtime; }
267
throw
_context
.WithLineInfo(new XamlObjectWriterException(err));
269
XamlMember parentProperty = (
_context
.CurrentType == null &&
_context
.Depth > 1)
270
?
_context
.ParentProperty
271
:
_context
.CurrentProperty; // there is a push frame below making this the parent property.
274
XamlType xamlType = (
_context
.CurrentType == null &&
_context
.Depth > 1)
275
?
_context
.ParentType
276
:
_context
.CurrentType;
282
throw
_context
.WithLineInfo(new XamlObjectWriterException(err));
292
if (
_context
.CurrentType != null)
294
_context
.PushScope();
297
TryCreateParentInstance(
_context
);
299
_context
.CurrentIsObjectFromMember = true;
301
object 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;
336
throw
_context
.WithLineInfo(new XamlObjectWriterException(err));
341
throw
_context
.WithLineInfo(new XamlObjectWriterException(err));
344
if (
_context
.CurrentType != null &&
_context
.CurrentProperty == null)
347
_context
.CurrentType.ToString());
348
throw
_context
.WithLineInfo(new XamlObjectWriterException(err));
358
if (
_context
.CurrentType != null)
360
_context
.PushScope();
363
_context
.CurrentType = xamlType;
370
if ((
_context
.LiveDepth == 1) && (_rootObjectInstance != null))
373
if (!rootType.CanAssignTo(
_context
.CurrentType))
378
_context
.CurrentInstance = _rootObjectInstance;
379
if (
_context
.CurrentType.IsCollection ||
_context
.CurrentType.IsDictionary)
381
_context
.CurrentCollection = _rootObjectInstance;
383
Logic_BeginInit(
_context
);
399
Debug.Assert(
_context
.CurrentProperty.DeferringLoader != null);
401
_context
.PushScope();
402
_context
.CurrentInstance = (XamlReader)templateList.GetReader();
412
throw
_context
.WithLineInfo(new XamlObjectWriterException(err));
414
if (
_context
.CurrentType == null)
417
throw
_context
.WithLineInfo(new XamlObjectWriterException(err));
419
if (
_context
.CurrentProperty != null)
421
string err = SR.Format(SR.OpenPropertyInCurrentFrame_EO,
_context
.CurrentType.ToString(),
422
_context
.CurrentProperty.ToString());
423
throw
_context
.WithLineInfo(new XamlObjectWriterException(err));
428
Debug.Assert(
_context
.LiveDepth > 0);
429
bool hasUnresolvedChildren = HasUnresolvedChildren(
_context
.CurrentInstance);
430
bool isFixupToken =
_context
.CurrentInstance is NameFixupToken;
432
if (!
_context
.CurrentIsObjectFromMember)
438
if (
_context
.CurrentInstance == null)
440
Logic_CreateAndAssignToParentStart(
_context
);
443
XamlType xamlType =
_context
.CurrentType;
444
object instance =
_context
.CurrentInstance;
447
if (
_context
.CurrentType.IsMarkupExtension)
452
Logic_DeferProvideValue(
_context
);
456
ExecutePendingAdds(
_context
.CurrentType,
_context
.CurrentInstance);
457
Logic_EndInit(
_context
);
458
instance =
_context
.CurrentInstance;
459
Logic_AssignProvidedValue(
_context
);
460
if (
_context
.CurrentInstanceRegisteredName != null)
465
TriggerNameResolution(instance,
_context
.CurrentInstanceRegisteredName);
467
_context
.CurrentInstanceRegisteredName = null;
469
instance =
_context
.CurrentInstance;
476
if (
_context
.LiveDepth > 1)
478
if (!
_context
.CurrentWasAssignedAtCreation)
480
Logic_DoAssignmentToParentProperty(
_context
);
488
if (
_context
.LiveDepth > 1)
490
Logic_AddDependencyForUnresolvedChildren(
_context
, null);
495
ExecutePendingAdds(
_context
.CurrentType,
_context
.CurrentInstance);
496
Logic_EndInit(
_context
);
504
Debug.Assert(
_context
.LiveDepth > 1);
505
Logic_AddDependencyForUnresolvedChildren(
_context
, null);
509
ExecutePendingAdds(
_context
.CurrentType,
_context
.CurrentInstance);
512
if (
_context
.ParentIsPropertyValueSet)
514
throw
_context
.WithLineInfo(new XamlDuplicateMemberException(
515
_context
.ParentProperty,
516
_context
.ParentType));
519
_lastInstance =
_context
.CurrentInstance;
520
string name =
_context
.CurrentInstanceRegisteredName;
522
if (
_context
.LiveDepth == 1)
524
_rootNamescope =
_context
.RootNameScope;
530
_context
.PopScope();
534
_nameFixupGraph.IsOffTheStack(_lastInstance, name,
_context
.LineNumber,
_context
.LinePosition);
556
if (
_context
.LiveDepth == 0 && !_inDispose)
559
_context
.RaiseNameScopeInitializationCompleteEvent();
585
err = SR.Format(SR.TypeHasNoContentProperty,
_context
.CurrentType);
591
else if (
_context
.CurrentProperty != null)
593
err = SR.Format(SR.OpenPropertyInCurrentFrame_SM,
_context
.CurrentType.ToString(),
594
_context
.CurrentProperty.ToString(),
597
else if (
_context
.CurrentType == null)
604
throw
_context
.WithLineInfo(new XamlObjectWriterException(err));
609
Debug.Assert(
_context
.LiveDepth > 0);
610
_context
.CurrentProperty = property;
614
Logic_DuplicatePropertyCheck(
_context
, property, false /*onParent*/);
618
if (
_context
.CurrentInstance == null)
620
if (!IsConstructionDirective(
_context
.CurrentProperty)
621
&& !IsDirectiveAllowedOnNullInstance(
_context
.CurrentProperty,
_context
.CurrentType))
623
Logic_CreateAndAssignToParentStart(
_context
);
630
_context
.CurrentCollection = new List<PositionalParameterDescriptor>();
638
throw
_context
.WithLineInfo(new XamlObjectWriterException(SR.Format(SR.LateConstructionDirective, property.Name)));
641
if (
_context
.CurrentIsTypeConvertedObject)
647
throw
_context
.WithLineInfo(new XamlObjectWriterException(SR.Format(SR.SettingPropertiesIsNotAllowed, property.Name)));
652
if (property.IsAttachable &&
_context
.CurrentInstance is NameFixupToken)
654
NameFixupToken token = (NameFixupToken)
_context
.CurrentInstance;
655
throw
_context
.WithLineInfo(new XamlObjectWriterException(SR.Format(SR.AttachedPropOnFwdRefTC,
656
property,
_context
.CurrentType, string.Join(", ", token.NeededNames.ToArray()))));
670
_context
.CurrentCollection = Runtime.CreateInstance(property.Type, null);
692
if (
_context
.CurrentType == null)
694
property =
_context
.ParentProperty;
699
property =
_context
.CurrentProperty;
704
string err = (
_context
.CurrentType != null)
705
? SR.Format(SR.NoPropertyInCurrentFrame_EM,
_context
.CurrentType.ToString())
708
throw
_context
.WithLineInfo(new XamlObjectWriterException(err));
720
_context
.CurrentCtorArgs = ((List<object>)
_context
.CurrentCollection).ToArray();
724
Logic_CreateFromInitializationValue(
_context
);
728
_context
.CurrentCollection = null;
732
Logic_ConvertPositionalParamsToArgs(
_context
);
737
if (
_context
.CurrentType == null)
739
value =
_context
.CurrentInstance;
740
_context
.PopScope();
742
Logic_ValidateXClass(
_context
, value);
744
else if (
_context
.CurrentType == null)
757
object value =
_context
.CurrentInstance;
765
_context
.CurrentInstance = me;
769
Logic_AssignProvidedValue(
_context
);
780
if (property.IsDirective && property == XamlLanguage.Key && !Logic_ShouldConvertKey(
_context
))
783
_context
.ParentKeyIsUnconverted = true;
787
shouldSetValue = Logic_CreatePropertyValueFromValue(
_context
);
792
_lastInstance =
_context
.CurrentInstance;
795
Logic_DoAssignmentToParentProperty(
_context
);
797
_context
.PopScope(); // Value Node Scope
802
_context
.CurrentProperty = null;
803
_context
.CurrentIsPropertyValueSet = false;
818
Debug.Assert(
_context
.CurrentProperty.DeferringLoader != null);
820
_context
.PushScope();
821
_context
.CurrentInstance = (XamlReader)templateList.GetReader();
828
XamlMember currentProperty =
_context
.CurrentProperty;
831
string err = (
_context
.CurrentType != null)
832
? SR.Format(SR.NoPropertyInCurrentFrame_V, value,
_context
.CurrentType.ToString())
835
throw
_context
.WithLineInfo(new XamlObjectWriterException(err));
841
_context
.PushScope();
842
_context
.CurrentInstance = value;
863
_context
.CurrentType = XamlLanguage.PositionalParameterDescriptor;
864
_context
.CurrentInstance = new PositionalParameterDescriptor(value, true);
865
Logic_DoAssignmentToParentCollection(
_context
);
866
_context
.PopScope();
870
_context
.CurrentInstance = value;
871
Logic_DoAssignmentToParentCollection(
_context
);
872
_context
.PopScope();
904
throw
_context
.WithLineInfo(new XamlObjectWriterException(err));
906
if (
_context
.CurrentType != null &&
_context
.CurrentProperty == null)
910
_context
.CurrentType.ToString());
911
throw
_context
.WithLineInfo(new XamlObjectWriterException(err));
915
if (
_context
.CurrentType != null)
917
_context
.PushScope();
919
_context
.AddNamespacePrefix(namespaceDeclaration.Prefix, namespaceDeclaration.Namespace);
925
while (
_context
.LiveDepth > 0)
927
_context
.PopScope();
932
_context
.PushScope();
942
bool seenStartObject =
_context
.LiveDepth > 1 ||
_context
.CurrentType != null;
945
while (
_context
.LiveDepth > 0)
947
if (
_context
.CurrentProperty != null)
989
return
_context
.RootNameScope;
1010
return
_context
.SchemaContext;
1019
_context
.LineNumber = lineNumber;
1020
_context
.LinePosition = linePosition;
1042
return
_context
.WithLineInfo(ex);
2355
!
_context
.IsOnTheLiveStack(token.TargetContext.CurrentInstance))
2386
if (
_context
.LiveDepth > 0)
2389
if (
_context
.IsOnTheLiveStack(instance))