Serialization issue on code that's not been changed.

Mar 27, 2014 at 6:18 PM
Hi Thomas,

Long time no speak (which is a good thing as have had no problems till now!).

Remember a year or so ago you helped me with a Dispatcher/Worker pattern (using the XCoAppSpace Pub/Sub) which I have just revisited now but although nothing has changed on the machines it's running (except windows updates), I am getting the following error on the remote server trying to connect to the dispatcher

Error deserializing content of received message. Further message information: WorkerMessage[Identifier=IDPS.Core.Utilities.PDispatcherWorker;Msg=XcoAppSpaces.Core.Subscribe`1[IDPS.Core.Utilities.NewWorkItemAvailable]] - Source: MyServer:9000 - Exception: Error deserializing message content: The constructor to deserialize an object of type 'System.RuntimeType' was not found.

I'm still using (although I aim to upgrade to but this is a very strange error considering the code has not changed. So I can connect to the Dispatcher ok but when the first message gets sent to the worker, I get that exception. It does not occur in the worker that is running on the same server as the dispatcher, only on the remote machines even though the local worker connects in the same way.

NewWorkItemAvailable is just a simple class

public class NewWorkItemAvailable
    public string HostName { get; set; }

    public bool MoreItemsAvailable { get; set; }

Have you ever seen this error or have any incling of what might be causing it to have suddenly stopped working?

Many thanks in advance as always

Mar 27, 2014 at 6:43 PM
Hi Mike,

Glad to hear that the appspace has been running smoothly until now!

Fortunately I can tell you what causes this error, as we also ran into it some time ago, and it cost me several hours to identify the problem. You have probably recently installed .Net Framework Version 4.5 on one of the communicating machines, and/or switched your application to compile on .Net 4.0/4.5.

It seems that in .Net 4.5 the base type of System.RuntimeType was changed from System.Type to System.Reflection.TypeInfo - because of that our custom type serialization did not work any more. This problem occurred as soon as .Net 4.5 was installed, for any program compiled to at least .Net 4.0, and led to these programs being unable to communicate with other programs that were compiled against .Net 3.5, or machines that didn't have 4.5 installed.

The Problem is fixed in AppSpace V1.4, so the best option would be to change to that version. It should be interoperable to V1.3 AppSpace versions that run on machines where .Net 4.5 is not installed, or to applications that are compiled in .Net 3.5.

Best Regards
Mar 28, 2014 at 11:09 AM
Thanks so much Thomas.

I think I would have goen for upgrading to the latest release as a first step but it's always good to know the actual reason for something failing.

Thanks for saving me the time of figuring this out

Kind regards