orleans: potential problem with generated serializer code
Using Orleans 1.4.1, I am getting these exceptions.
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at Orleans.Serialization.BuiltInTypes.SerializeList[T](Object obj, ISerializationContext context, Type expected)
at Orleans.Serialization.SerializationManager.SerializeInner(Object obj, ISerializationContext context, Type expected)
at NotificationServer.Model.OrleansCodeGenNotificationServer_Model_WellSubscriptionEventSerializer.Serializer(Object untypedInput, ISerializationContext context, Type expected) in C:\Source\myproject\NotificationServer\NotificationServer.Model\obj\Debug\NotificationServer.Model.orleans.g.cs:line 414
at Orleans.Serialization.SerializationManager.SerializeInner(Object obj, ISerializationContext context, Type expected)
at Orleans.Serialization.BuiltInTypes.SerializeImmutable[T](Object original, ISerializationContext context, Type expected)
at Orleans.Serialization.SerializationManager.SerializeInner(Object obj, ISerializationContext context, Type expected)
at Orleans.Serialization.BuiltInTypes.SerializeInvokeMethodRequest(Object obj, ISerializationContext context, Type expected)
at Orleans.Serialization.SerializationManager.SerializeInner(Object obj, ISerializationContext context, Type expected)
at Orleans.Serialization.SerializationManager.Serialize(Object raw, BinaryTokenStreamWriter stream)
at Orleans.Runtime.Message.Serialize_Impl(Int32& headerLengthOut, Int32& bodyLengthOut)
at Orleans.Runtime.Messaging.Gateway.GatewaySender.Send(Message msg, Socket sock)
The line of code referred to is part of the generated code file (*.g.cs). Line 414 of it says:
global::Orleans.Serialization.SerializationManager.@SerializeInner(input.@WellIDs, context, typeof (global::System.Collections.Generic.List<global::System.Guid>));
Here is the whole generated class:
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Orleans-CodeGenerator", "1.4.1.0"), global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute, global::Orleans.CodeGeneration.SerializerAttribute(typeof (global::NotificationServer.Model.WellSubscriptionEvent))]
internal class OrleansCodeGenNotificationServer_Model_WellSubscriptionEventSerializer
{
[global::Orleans.CodeGeneration.CopierMethodAttribute]
public static global::System.Object DeepCopier(global::System.Object original, global::Orleans.Serialization.ICopyContext context)
{
global::NotificationServer.Model.WellSubscriptionEvent input = ((global::NotificationServer.Model.WellSubscriptionEvent)original);
global::NotificationServer.Model.WellSubscriptionEvent result = new global::NotificationServer.Model.WellSubscriptionEvent();
context.@RecordCopy(original, result);
result.@SubscribeAction = input.@SubscribeAction;
result.@WellIDs = (global::System.Collections.Generic.List<global::System.Guid>)global::Orleans.Serialization.SerializationManager.@DeepCopyInner(input.@WellIDs, context);
return result;
}
[global::Orleans.CodeGeneration.SerializerMethodAttribute]
public static void Serializer(global::System.Object untypedInput, global::Orleans.Serialization.ISerializationContext context, global::System.Type expected)
{
global::NotificationServer.Model.WellSubscriptionEvent input = (global::NotificationServer.Model.WellSubscriptionEvent)untypedInput;
global::Orleans.Serialization.SerializationManager.@SerializeInner(input.@SubscribeAction, context, typeof (global::NotificationServer.Model.WellSubscribeAction));
global::Orleans.Serialization.SerializationManager.@SerializeInner(input.@WellIDs, context, typeof (global::System.Collections.Generic.List<global::System.Guid>)); // line 414
}
[global::Orleans.CodeGeneration.DeserializerMethodAttribute]
public static global::System.Object Deserializer(global::System.Type expected, global::Orleans.Serialization.IDeserializationContext context)
{
global::NotificationServer.Model.WellSubscriptionEvent result = new global::NotificationServer.Model.WellSubscriptionEvent();
context.@RecordObject(result);
result.@SubscribeAction = (global::NotificationServer.Model.WellSubscribeAction)global::Orleans.Serialization.SerializationManager.@DeserializeInner(typeof (global::NotificationServer.Model.WellSubscribeAction), context);
result.@WellIDs = (global::System.Collections.Generic.List<global::System.Guid>)global::Orleans.Serialization.SerializationManager.@DeserializeInner(typeof (global::System.Collections.Generic.List<global::System.Guid>), context);
return (global::NotificationServer.Model.WellSubscriptionEvent)result;
}
}
The serializer’s target type has just two (public) properties: an enum and a List<Guid>. The class is public and has the Serializable attribute on it.
What am I missing? Why would I get this error from the generated code?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 22 (22 by maintainers)
On the ClusterConfiguration object:
StreamProviderNames.SimpleMessageStreamProvider = “SMSProvider”