Devart Exceptions is not marked as serializable

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
mineevev
Posts: 5
Joined: Wed 07 Apr 2010 12:56

Devart Exceptions is not marked as serializable

Post by mineevev » Mon 01 Nov 2010 07:47

Hello!

I used Remoting and if in execution happen error - the exception not pass to client with Remoting channal


EXCEPTION TYPE: System.Runtime.Serialization.SerializationException
MESSAGE:
Type 'Devart.Data.Linq.LinqCommandExecutionException' in Assembly 'Devart.Data.Linq, Version=1.0.33.0, Culture=neutral, PublicKeyToken=09af7300eec23701' is not marked as serializable.
STACK TRACE:

Please marke as serializable the class (and other exceptions in devart lib - it is necessary that use remoting with no restrictions)

Best regards

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Mon 01 Nov 2010 14:53

Thank you for your suggestion, we will consider marking exceptions from the Devart.Data.Linq namespace as serializable.

mineevev
Posts: 5
Joined: Wed 07 Apr 2010 12:56

Post by mineevev » Tue 02 Nov 2010 07:09

Diar Stanislav!


Thanks for the fast response!

When will I get new distribution of dcoracle560pro.exe ?
Could you please will notify me?


with best personal regards

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Tue 02 Nov 2010 10:24

We will inform you here when the corresponding build is ready.

rmontoya
Posts: 8
Joined: Wed 20 Oct 2010 20:29

Post by rmontoya » Tue 02 Nov 2010 21:38

Hi mineevev-

If the DevArt exception was remotable it would require the DevArt assemblies to be on the client machine. A better approach would be to catch the DevArt exceptions on the remote side and then wrap them in a custom remotable exception that can be shipped with the client. The constructor of the remotable exception could then take the properties you are interested in:

Code: Select all

public DatabaseException(string source, string helpLink, int number, string message, Exception innerException)
            : base(message, innerException)
Catch and wrap:

Code: Select all

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch (OracleException oe)
                {
                    // Wrap the OracleException details in a remotable exception
                    throw new DatabaseException(oe.Source, oe.HelpLink, oe.Code, oe.Message, oe.InnerException);
                }
This example is for an OracleException but you could modify the constructor to take any properties you wanted for the Linq exception.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Wed 03 Nov 2010 14:31

Thank you for sharing your knowledge.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 11 Nov 2010 17:25

We've added the possibility of serializing LinqConnect exceptions. This change is available in the latest 2.0.7 Beta build of LinqConnect; the corresponding version of dotConnect for Oracle is Beta 6.0.46. dotConnect for Oracle Beta 6.0.46 can be downloaded from
http://www.devart.com/dotconnect/oracle/download.html
(the trial version) or from Registered Users' Area (for users with active subscription only):
http://secure.devart.com/

For the detailed information about the fixes and improvements implemented in dotConnect for Oracle Beta 6.0.46, please refer to
http://www.devart.com/forums/viewtopic.php?t=19496

mineevev
Posts: 5
Joined: Wed 07 Apr 2010 12:56

Post by mineevev » Thu 10 Feb 2011 14:23

Diar Stanislav!
Thank You for answers!

I downloaded version 6.10 and take LinqCommandExecutionException



using System;

namespace Devart.Data.Linq
{
[Serializable]
public class LinqCommandExecutionException : Exception
{
}
}



Uunfortunately, I haven't seen a mandatory constructor to deserialize an object of the exception type.

Here's an example taken from the MSDN, and I propose a solution:
using System;

namespace Devart.Data.Linq
{
[Serializable]
public class LinqCommandExecutionException : Exception
{
public LinqCommandExecutionException () { }
public LinqCommandExecutionException (string message) { }
public LinqCommandExecutionException (string message, System.Exception inner) { }
// Constructor needed for serialization
// when exception propagates from a remoting server to the client.
protected LinqCommandExecutionException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context):base(info,context) { }
}
}

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Fri 11 Feb 2011 16:31

Thank you for your suggestion, we will analyze the possible ways of deserializing LinqConnect exceptions, and will post here about the results.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 17 Feb 2011 17:35

We have fixed this issue, now it should be possible to deserialize LinqConnect exceptions. The fix will be available in the nearest build which we plan to release in about a week.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 24 Feb 2011 17:37

We have released the new 6.10.111 build of dotConnect for Oracle which includes the fix for the LinqConnect exceptions deserialization. The new build can be downloaded from
http://www.devart.com/dotconnect/oracle/download.html
(the trial version) or from Registered Users' Area (for users with active subscription only):
http://secure.devart.com/

For the detailed information about the fixes and improvements available in dotConnect for Oracle 6.10.111, please refer to
http://www.devart.com/forums/viewtopic.php?t=20337

Post Reply