Page 1 of 1
Devart Exceptions is not marked as serializable
Posted: Mon 01 Nov 2010 07:47
by mineevev
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
Posted: Mon 01 Nov 2010 14:53
by StanislavK
Thank you for your suggestion, we will consider marking exceptions from the Devart.Data.Linq namespace as serializable.
Posted: Tue 02 Nov 2010 07:09
by mineevev
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
Posted: Tue 02 Nov 2010 10:24
by StanislavK
We will inform you here when the corresponding build is ready.
Posted: Tue 02 Nov 2010 21:38
by rmontoya
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.
Posted: Wed 03 Nov 2010 14:31
by StanislavK
Thank you for sharing your knowledge.
Posted: Thu 11 Nov 2010 17:25
by StanislavK
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
Posted: Thu 10 Feb 2011 14:23
by mineevev
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) { }
}
}
Posted: Fri 11 Feb 2011 16:31
by StanislavK
Thank you for your suggestion, we will analyze the possible ways of deserializing LinqConnect exceptions, and will post here about the results.
Posted: Thu 17 Feb 2011 17:35
by StanislavK
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.
Posted: Thu 24 Feb 2011 17:37
by StanislavK
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