protected override void CustomizeGetObjectData( CodeBuilder codebuilder, ArgumentReference serializationInfo, ArgumentReference streamingContext, ClassEmitter emitter ) { var targetField = emitter.GetField("__target"); codebuilder.AddStatement( new MethodInvocationExpression( serializationInfo, SerializationInfoMethods.AddValue_Object, new LiteralStringExpression("__targetFieldType"), new LiteralStringExpression( targetField.Reference.FieldType.AssemblyQualifiedName ) ) ); codebuilder.AddStatement( new MethodInvocationExpression( serializationInfo, SerializationInfoMethods.AddValue_Object, new LiteralStringExpression("__theInterface"), new LiteralStringExpression(targetType.AssemblyQualifiedName) ) ); }
public override void EnsureValidCodeBlock() { if (CodeBuilder.IsEmpty) { CodeBuilder.AddStatement(new ReturnStatement()); } }
public virtual void EnsureValidCodeBlock() { if (ImplementedByRuntime == false && CodeBuilder.IsEmpty) { CodeBuilder.AddStatement(new NopStatement()); CodeBuilder.AddStatement(new ReturnStatement()); } }
public virtual void EnsureValidCodeBlock() { if (CodeBuilder.IsEmpty) { CodeBuilder.InvokeBaseConstructor(); CodeBuilder.AddStatement(new ReturnStatement()); } }
public virtual void EnsureValidCodeBlock() { if (CodeBuilder.IsEmpty) { CodeBuilder.AddStatement(new NopStatement()); CodeBuilder.AddStatement(new ReturnStatement()); } }
private void EmitCallToBaseGetObjectData(CodeBuilder codebuilder, ArgumentReference serializationInfo, ArgumentReference streamingContext) { var baseGetObjectData = targetType.GetMethod("GetObjectData", new[] { typeof(SerializationInfo), typeof(StreamingContext) }); codebuilder.AddStatement( new MethodInvocationExpression( baseGetObjectData, serializationInfo, streamingContext)); }
private void EmitCustomGetObjectData( CodeBuilder codebuilder, ArgumentReference serializationInfo ) { var members = codebuilder.DeclareLocal(typeof(MemberInfo[])); var data = codebuilder.DeclareLocal(typeof(object[])); var getSerializableMembers = new MethodInvocationExpression( null, FormatterServicesMethods.GetSerializableMembers, new TypeTokenExpression(targetType) ); codebuilder.AddStatement(new AssignStatement(members, getSerializableMembers)); // Sort to keep order on both serialize and deserialize side the same, c.f DYNPROXY-ISSUE-127 var callSort = new MethodInvocationExpression(null, TypeUtilMethods.Sort, members); codebuilder.AddStatement(new AssignStatement(members, callSort)); var getObjectData = new MethodInvocationExpression( null, FormatterServicesMethods.GetObjectData, SelfReference.Self, members ); codebuilder.AddStatement(new AssignStatement(data, getObjectData)); var addValue = new MethodInvocationExpression( serializationInfo, SerializationInfoMethods.AddValue_Object, new LiteralStringExpression("__data"), data ); codebuilder.AddStatement(addValue); }
protected override void CustomizeGetObjectData(CodeBuilder codebuilder, ArgumentReference serializationInfo, ArgumentReference streamingContext, ClassEmitter emitter) { codebuilder.AddStatement( new MethodInvocationExpression( serializationInfo, SerializationInfoMethods.AddValue_Bool, new ConstReference("__delegateToBase"), new ConstReference(delegateToBaseGetObjectData))); if (delegateToBaseGetObjectData == false) { EmitCustomGetObjectData(codebuilder, serializationInfo); return; } EmitCallToBaseGetObjectData(codebuilder, serializationInfo, streamingContext); }
protected void CompleteInitCacheMethod(CodeBuilder constCodeBuilder) { constCodeBuilder.AddStatement(new ReturnStatement()); }