Azure/azure-cosmos-table-dotnet

Exception: Type 'Microsoft.Azure.Cosmos.Table.StorageException' in Assembly 'Microsoft.Azure.Cosmos.Table, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not marked as serializable.

Petchiammal opened this issue · 3 comments

Hi,
We have created Cloud Service Project using C# in VS2019. We are using Microsoft.Azure.Cosmos.Table of Version 1.0.8 for Azure Storage Table access When we are deploying the cloud service , WebRole shows "Busy. recovering role with some exception". but Worker role shows Running Status.

Stacktrace:
Starting role... Calling OnRoleStart. [2020-08-30T16:05:49Z] Last exit time: [2020/08/30, 16:05:34.568]. Last exit code: 0. Last role exception: System.Runtime.Serialization.SerializationException, Details: Exception: Type 'Microsoft.Azure.Cosmos.Table.StorageException' in Assembly 'Microsoft.Azure.Cosmos.Table, Version=1.0.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not marked as serializable. at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.SerializeObject(Object obj, MemoryStream stm) at System.AppDomain.Serialize(Object o) at System.AppDomain.MarshalObject(Object o) '

@sakash279 We don't intend to make StorageExceptions serializable, at the moment. You need to catch this in your code and extract the relevant information for your debugging purposes. If you handle this exception gracefully, your Cloud Service deployment shouldn't be blocked.

WY-S commented

@sakash279 We don't intend to make StorageExceptions serializable, at the moment. You need to catch this in your code and extract the relevant information for your debugging purposes. If you handle this exception gracefully, your Cloud Service deployment shouldn't be blocked.

@christopheranderson Hi Christopher. May I ask if we could use [Serializable()] on the relevant code to solve the issue? Like:

[Serializable()]
public static void Cosmos_Tables()
{
...
}

@WY-S You will need to copy StorageException properties to your own serializable class.