4 writes to _ilg
System.Private.DataContractSerialization (4)
System\Runtime\Serialization\XmlFormatReaderGenerator.cs (4)
88
_ilg
= new CodeGenerator();
180
_ilg
= GenerateCollectionReaderHelper(collectionContract, false /*isGetOnlyCollection*/);
205
_ilg
= GenerateCollectionReaderHelper(collectionContract, true /*isGetOnlyCollection*/);
214
_ilg
= new CodeGenerator();
265 references to _ilg
System.Private.DataContractSerialization (265)
System\Runtime\Serialization\XmlFormatReaderGenerator.cs (265)
92
_ilg
.BeginMethod("Read" + classContract.XmlName.Name + "FromXml", Globals.TypeOfXmlFormatClassReaderDelegate, memberAccessFlag);
108
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, _objectLocal);
113
objectId =
_ilg
.DeclareLocal(Globals.TypeOfString);
114
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.GetObjectIdMethod);
115
_ilg
.Stloc(objectId);
130
_ilg
.Call(_objectLocal, XmlFormatGeneratorStatics.OnDeserializationMethod, null);
136
_ilg
.Load(_objectLocal);
144
_ilg
.ConvertValue(_objectLocal.LocalType, Globals.TypeOfDateTimeOffsetAdapter);
145
_ilg
.Call(XmlFormatGeneratorStatics.GetDateTimeOffsetMethod);
146
_ilg
.ConvertValue(Globals.TypeOfDateTimeOffset,
_ilg
.CurrentMethod.ReturnType);
150
_ilg
.ConvertValue(_objectLocal.LocalType, Globals.TypeOfMemoryStreamAdapter);
151
_ilg
.Call(XmlFormatGeneratorStatics.GetMemoryStreamMethod);
152
_ilg
.ConvertValue(Globals.TypeOfMemoryStream,
_ilg
.CurrentMethod.ReturnType);
156
_ilg
.ConvertValue(_objectLocal.LocalType,
_ilg
.CurrentMethod.ReturnType);
159
return (XmlFormatClassReaderDelegate)
_ilg
.EndMethod();
182
_ilg
.Load(_objectLocal);
183
_ilg
.ConvertValue(_objectLocal.LocalType,
_ilg
.CurrentMethod.ReturnType);
184
return (XmlFormatCollectionReaderDelegate)
_ilg
.EndMethod();
207
return (XmlFormatGetOnlyCollectionReaderDelegate)
_ilg
.EndMethod();
220
_ilg
.BeginMethod("Read" + collectionContract.XmlName.Name + "FromXml" + "IsGetOnly", Globals.TypeOfXmlFormatGetOnlyCollectionReaderDelegate, memberAccessFlag);
224
_ilg
.BeginMethod("Read" + collectionContract.XmlName.Name + "FromXml" + string.Empty, Globals.TypeOfXmlFormatCollectionReaderDelegate, memberAccessFlag);
239
_collectionContractArg =
_ilg
.GetArg(4);
240
return
_ilg
;
245
_xmlReaderArg =
_ilg
.GetArg(0);
246
_contextArg =
_ilg
.GetArg(1);
247
_memberNamesArg =
_ilg
.GetArg(2);
248
_memberNamespacesArg =
_ilg
.GetArg(3);
260
_objectLocal =
_ilg
.DeclareLocal(type);
264
_ilg
.LoadMember(GetDBNullValueField());
265
_ilg
.Stloc(_objectLocal);
271
_ilg
.Ldloca(_objectLocal);
272
_ilg
.InitObj(type);
276
_ilg
.New(classContract.GetNonAttributedTypeConstructor()!);
277
_ilg
.Stloc(_objectLocal);
282
_ilg
.Call(null, XmlFormatGeneratorStatics.GetUninitializedObjectMethod, DataContract.GetIdForInitialization(classContract));
283
_ilg
.ConvertValue(Globals.TypeOfObject, type);
284
_ilg
.Stloc(_objectLocal);
299
_ilg
.LoadAddress(_objectLocal);
300
_ilg
.ConvertAddress(_objectLocal.LocalType, _objectType);
301
_ilg
.Load(_contextArg);
302
_ilg
.LoadMember(XmlFormatGeneratorStatics.GetStreamingContextMethod);
303
_ilg
.Call(classContract.OnDeserializing);
316
_ilg
.LoadAddress(_objectLocal);
317
_ilg
.ConvertAddress(_objectLocal.LocalType, _objectType);
318
_ilg
.Load(_contextArg);
319
_ilg
.LoadMember(XmlFormatGeneratorStatics.GetStreamingContextMethod);
320
_ilg
.Call(classContract.OnDeserialized);
335
_ilg
.Load(_contextArg);
336
_ilg
.LoadAddress(_objectLocal);
337
_ilg
.ConvertAddress(_objectLocal.LocalType, Globals.TypeOfIObjectReference);
338
_ilg
.Load(objectId);
339
_ilg
.Call(XmlFormatGeneratorStatics.GetRealObjectMethod);
340
_ilg
.ConvertValue(Globals.TypeOfObject,
_ilg
.CurrentMethod.ReturnType);
353
LocalBuilder extensionDataLocal =
_ilg
.DeclareLocal(Globals.TypeOfExtensionDataObject);
354
_ilg
.New(XmlFormatGeneratorStatics.ExtensionDataObjectCtor);
355
_ilg
.Store(extensionDataLocal);
363
_ilg
.Call(_objectLocal, extensionDataSetMethod, extensionDataLocal);
378
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, memberCount);
380
LocalBuilder memberIndexLocal =
_ilg
.DeclareLocal(Globals.TypeOfInt, -1);
385
LocalBuilder? requiredIndexLocal = hasRequiredMembers ?
_ilg
.DeclareLocal(Globals.TypeOfInt, firstRequiredMember) : null;
387
object forReadElements =
_ilg
.For(null, null, null);
388
_ilg
.Call(null, XmlFormatGeneratorStatics.MoveToNextElementMethod, _xmlReaderArg);
389
_ilg
.IfFalseBreak(forReadElements);
391
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.GetMemberIndexWithRequiredMembersMethod, _xmlReaderArg, _memberNamesArg, _memberNamespacesArg, memberIndexLocal, requiredIndexLocal, extensionDataLocal);
393
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.GetMemberIndexMethod, _xmlReaderArg, _memberNamesArg, _memberNamespacesArg, memberIndexLocal, extensionDataLocal);
396
Label[] memberLabels =
_ilg
.Switch(memberCount);
398
_ilg
.EndSwitch();
402
_ilg
.Pop();
404
_ilg
.EndFor();
407
_ilg
.If(requiredIndexLocal!, Cmp.LessThan, memberCount);
408
_ilg
.Call(null, XmlFormatGeneratorStatics.ThrowRequiredMemberMissingExceptionMethod, _xmlReaderArg, memberIndexLocal, requiredIndexLocal, _memberNamesArg);
409
_ilg
.EndIf();
427
_ilg
.Case(memberLabels[memberCount]);
434
_ilg
.Set(requiredIndexLocal!, nextRequiredIndex);
441
_ilg
.LoadAddress(_objectLocal);
442
_ilg
.LoadMember(dataMember.MemberInfo);
443
value =
_ilg
.DeclareLocal(memberType);
444
_ilg
.Stloc(value);
445
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.StoreCollectionMemberInfoMethod, value);
450
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.ResetCollectionMemberInfoMethod);
452
_ilg
.LoadAddress(_objectLocal);
453
_ilg
.ConvertAddress(_objectLocal.LocalType, _objectType);
454
_ilg
.Ldloc(value);
455
_ilg
.StoreMember(dataMember.MemberInfo);
458
_ilg
.Set(memberIndexLocal, memberCount);
460
_ilg
.EndCase();
494
_ilg
.LoadAddress(_objectLocal);
495
_ilg
.ConvertAddress(_objectLocal.LocalType, _objectType);
496
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.ReadSerializationInfoMethod, _xmlReaderArg, classContract.UnderlyingType);
497
_ilg
.Load(_contextArg);
498
_ilg
.LoadMember(XmlFormatGeneratorStatics.GetStreamingContextMethod);
499
_ilg
.Call(ctor);
506
LocalBuilder value =
_ilg
.DeclareLocal(type);
518
LocalBuilder objectId =
_ilg
.DeclareLocal(Globals.TypeOfString);
519
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.ReadAttributesMethod, _xmlReaderArg);
520
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.ReadIfNullOrRefMethod, _xmlReaderArg, type, DataContract.IsTypeSerializable(type));
521
_ilg
.Stloc(objectId);
523
_ilg
.If(objectId, Cmp.EqualTo, Globals.NullObjectId);
526
_ilg
.LoadAddress(value);
527
_ilg
.InitObj(value.LocalType);
533
_ilg
.Load(null);
534
_ilg
.Stloc(value);
540
_ilg
.ElseIfIsEmptyString(objectId);
541
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.GetObjectIdMethod);
542
_ilg
.Stloc(objectId);
545
_ilg
.IfNotIsEmptyString(objectId);
547
_ilg
.EndIf();
552
value =
_ilg
.DeclareLocal(type);
557
_ilg
.Call(_xmlReaderArg, primitiveContract.XmlFormatReaderMethod);
558
_ilg
.Stloc(value);
560
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, value);
567
_ilg
.Else();
572
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.GetExistingObjectMethod, objectId, type, name, ns);
573
_ilg
.ConvertValue(Globals.TypeOfObject, type);
574
_ilg
.Stloc(value);
576
_ilg
.EndIf();
580
_ilg
.If(objectId, Cmp.NotEqualTo, Globals.NullObjectId);
582
_ilg
.EndIf();
597
_ilg
.Load(_contextArg);
598
_ilg
.Load(_xmlReaderArg);
600
_ilg
.Load(DataContract.GetId(declaredType.TypeHandle));
601
_ilg
.Ldtoken(declaredType);
602
_ilg
.Load(name);
603
_ilg
.Load(ns);
604
_ilg
.Call(XmlFormatGeneratorStatics.InternalDeserializeMethod);
607
_ilg
.Call(XmlFormatGeneratorStatics.UnboxPointer);
609
_ilg
.ConvertValue(Globals.TypeOfObject, type);
611
_ilg
.Stloc(value);
619
_ilg
.LoadAddress(outerValue);
620
_ilg
.Load(innerValue);
624
_ilg
.New(type.GetConstructor(new Type[] { innerType })!);
627
_ilg
.Call(outerType.GetConstructor(new Type[] { innerType })!);
667
_objectLocal =
_ilg
.DeclareLocal(type);
672
_ilg
.Ldloca(_objectLocal);
673
_ilg
.InitObj(type);
677
_ilg
.New(constructor);
678
_ilg
.Stloc(_objectLocal);
679
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, _objectLocal);
683
LocalBuilder size =
_ilg
.DeclareLocal(Globals.TypeOfInt);
684
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.GetArraySizeMethod);
685
_ilg
.Stloc(size);
687
LocalBuilder objectId =
_ilg
.DeclareLocal(Globals.TypeOfString);
688
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.GetObjectIdMethod);
689
_ilg
.Stloc(objectId);
695
_ilg
.IfNot();
698
_ilg
.If(size, Cmp.EqualTo, -1);
703
growingCollection =
_ilg
.DeclareLocal(type);
704
_ilg
.NewArray(itemType, 32);
705
_ilg
.Stloc(growingCollection);
707
LocalBuilder i =
_ilg
.DeclareLocal(Globals.TypeOfInt);
708
object forLoop =
_ilg
.For(i, 0, int.MaxValue);
710
_ilg
.If();
711
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, 1);
717
_ilg
.Call(null, ensureArraySizeMethod, growingCollection, i);
718
_ilg
.Stloc(growingCollection);
719
_ilg
.StoreArrayElement(growingCollection, i, value);
723
_ilg
.Else();
725
_ilg
.If();
726
_ilg
.Break(forLoop);
727
_ilg
.Else();
729
_ilg
.EndIf();
730
_ilg
.EndIf();
732
_ilg
.EndFor();
736
_ilg
.Call(null, trimArraySizeMethod, growingCollection, i);
737
_ilg
.Stloc(_objectLocal);
738
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectWithIdMethod, objectId, _objectLocal);
740
_ilg
.Else();
742
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, size);
745
_ilg
.NewArray(itemType, size);
746
_ilg
.Stloc(_objectLocal);
747
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, _objectLocal);
749
LocalBuilder j =
_ilg
.DeclareLocal(Globals.TypeOfInt);
750
_ilg
.For(j, 0, size);
752
_ilg
.If();
755
_ilg
.StoreArrayElement(_objectLocal, j, itemValue);
758
_ilg
.Else();
760
_ilg
.EndIf();
761
_ilg
.EndFor();
762
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.CheckEndOfArrayMethod, _xmlReaderArg, size, _memberNamesArg, _memberNamespacesArg);
763
_ilg
.EndIf();
767
_ilg
.Else();
768
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectWithIdMethod, objectId, _objectLocal);
769
_ilg
.EndIf();
783
_objectLocal =
_ilg
.DeclareLocal(type);
784
_ilg
.Load(_contextArg);
785
_ilg
.LoadMember(XmlFormatGeneratorStatics.GetCollectionMemberMethod);
786
_ilg
.ConvertValue(Globals.TypeOfObject, type);
787
_ilg
.Stloc(_objectLocal);
791
_ilg
.If();
792
_ilg
.If(_objectLocal, Cmp.EqualTo, null);
793
_ilg
.Call(null, XmlFormatGeneratorStatics.ThrowNullValueReturnedForGetOnlyCollectionExceptionMethod, type);
795
_ilg
.Else();
796
LocalBuilder size =
_ilg
.DeclareLocal(Globals.TypeOfInt);
799
_ilg
.Load(_objectLocal);
800
_ilg
.Call(XmlFormatGeneratorStatics.GetArrayLengthMethod);
801
_ilg
.Stloc(size);
804
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.AddNewObjectMethod, _objectLocal);
806
LocalBuilder i =
_ilg
.DeclareLocal(Globals.TypeOfInt);
807
object forLoop =
_ilg
.For(i, 0, int.MaxValue);
809
_ilg
.If();
810
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.IncrementItemCountMethod, 1);
814
_ilg
.If(size, Cmp.EqualTo, i);
815
_ilg
.Call(null, XmlFormatGeneratorStatics.ThrowArrayExceededSizeExceptionMethod, size, type);
816
_ilg
.Else();
817
_ilg
.StoreArrayElement(_objectLocal, i, value);
818
_ilg
.EndIf();
822
_ilg
.Else();
824
_ilg
.If();
825
_ilg
.Break(forLoop);
826
_ilg
.Else();
828
_ilg
.EndIf();
829
_ilg
.EndIf();
830
_ilg
.EndFor();
831
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.CheckEndOfArrayMethod, _xmlReaderArg, size, _memberNamesArg, _memberNamespacesArg);
833
_ilg
.EndIf();
834
_ilg
.EndIf();
876
_ilg
.Load(_xmlReaderArg);
877
_ilg
.Load(_contextArg);
878
_ilg
.Load(_memberNamesArg);
879
_ilg
.Load(_memberNamespacesArg);
880
_ilg
.Load(size);
881
_ilg
.Ldloca(_objectLocal);
882
_ilg
.Call(typeof(XmlReaderDelegator).GetMethod(readArrayMethod, Globals.ScanAllMembers)!);
894
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.ResetAttributesMethod);
895
LocalBuilder value =
_ilg
.DeclareLocal(itemType);
896
_ilg
.Load(_collectionContractArg);
897
_ilg
.Call(XmlFormatGeneratorStatics.GetItemContractMethod);
898
_ilg
.Load(_xmlReaderArg);
899
_ilg
.Load(_contextArg);
900
_ilg
.Call(XmlFormatGeneratorStatics.ReadXmlValueMethod);
901
_ilg
.ConvertValue(Globals.TypeOfObject, itemType);
902
_ilg
.Stloc(value);
926
LocalBuilder pairKey =
_ilg
.DeclareLocal(keyMember.MemberType);
927
LocalBuilder pairValue =
_ilg
.DeclareLocal(valueMember.MemberType);
928
_ilg
.LoadAddress(value);
929
_ilg
.LoadMember(keyMember.MemberInfo);
930
_ilg
.Stloc(pairKey);
931
_ilg
.LoadAddress(value);
932
_ilg
.LoadMember(valueMember.MemberInfo);
933
_ilg
.Stloc(pairValue);
935
_ilg
.Call(collection, collectionContract.AddMethod, pairKey, pairValue);
937
_ilg
.Pop();
941
_ilg
.Call(collection, collectionContract.AddMethod, value);
943
_ilg
.Pop();
950
_ilg
.If();
951
_ilg
.Call(_contextArg, XmlFormatGeneratorStatics.SkipUnknownElementMethod, _xmlReaderArg);
952
_ilg
.Dec(iterator);
953
_ilg
.Else();
955
_ilg
.EndIf();
960
_ilg
.Call(_xmlReaderArg, XmlFormatGeneratorStatics.IsStartElementMethod2, nameArg, nsArg);
965
_ilg
.Call(_xmlReaderArg, XmlFormatGeneratorStatics.IsStartElementMethod0);
970
_ilg
.Load(_xmlReaderArg);
971
_ilg
.LoadMember(XmlFormatGeneratorStatics.NodeTypeProperty);
972
_ilg
.Load(XmlNodeType.EndElement);
973
_ilg
.Ceq();
978
_ilg
.Call(null, XmlFormatGeneratorStatics.CreateUnexpectedStateExceptionMethod, expectedState, _xmlReaderArg);
979
_ilg
.Throw();
984
_ilg
.Load(msg);
990
_ilg
.New(XmlFormatGeneratorStatics.SerializationExceptionCtor);
991
_ilg
.Throw();