I am receiving the following exception
"Timeout while inspecting metadata; this may indicate a deadlock. This can
often be avoided by preparing necessary serializers during application
initialization, rather than allowing multiple threads to perform the initial
metadata inspection; please also see the LockContended event (System.String)"
when attempting to serialize/deserialize an object using protobuf.net. I am
using the protobuf.net for Silverlight and WCF service. serialize the result on
WCF service and deserialize the same response on client(Silverlight) end.
I have used extension method for that. here is code for that
public static byte[] GetSerializeByteArray<T>( this T entity )
{
using ( var stream = new MemoryStream() )
{
Serializer.Serialize( stream, entity );
return stream.ToArray();
}
}
public static T DeserializeByteArray<T>( this byte[] byteArray )
{
if ( byteArray == null )
{
throw new ArgumentNullException( "byteArray" );
}
try
{
using ( Stream result = new MemoryStream( byteArray ) )
{
return Serializer.Deserialize<T>( result );
}
}
catch ( Exception )
{
throw new InvalidOperationException( "Invalid Type" );
}
}
and here is our model class that reside on other project(Portable Class
Library) and used on both end client(Silverlight) and server(WCF) end.
[ProtoContract]
public class Class1
{
[ProtoMember( 1 )]
public string Name
}
I do not understand that why this exception occurred again and again! Can you
please explain it to me, Is this a correct way to use protobuf-net
implementation.
Original issue reported on code.google.com by aady78...@gmail.com on 10 May 2013 at 2:47
Original issue reported on code.google.com by
aady78...@gmail.com
on 10 May 2013 at 2:47