Passsing a LogEntry to EntLib Via WCF - serialzation

Topics: General discussion, Logging Application Block
Apr 15, 2009 at 10:51 PM
Simply stated, we have a logging service (WCF) that contains a custom trace listener. We send EntLib Log Entries to the logging service, the logging services writes them to a log database.

Orignially we were using a data contract to send the Log Entry across the wire.  However, one of our developers modified the code to just send the Log Entry directly, and it appears to be working.

Can we rely on WCF to serialize the Log Entry (including the dictionary in which we have the stack trace and other information) such that Enterprise Library trace listeners can use it?

I read the following post and am not so sure we are safe doing this:

Quick recap: While WCF allows me to serialize an IDictionary easily, trying to serialize that dictionary later for other uses fails - specifically, caching it to disk using the Enterprise Library. This is because the Enterprise Library relies on the BinaryFormatter, which in turns relies on the type implementing ISerializable

Should we use a data contract and manually handling the dictionary serialization?
It looks like IDictionary implements ISerializable to me

Clarification experinece much appreciated


Apr 16, 2009 at 10:31 AM
I think passing the LogEntry directly is ok, but I issues may arise if you have an IDictionary with values of type object and that object is not serializable.

Sarah Urmeneta
Global Technology & Solutions
Avanade, INc.