Devart Exceptions is not marked as serializable
Devart Exceptions is not marked as serializable
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
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
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
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:
Catch and wrap:
This example is for an OracleException but you could modify the constructor to take any properties you wanted for the Linq exception.
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)
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);
}
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
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
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
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) { }
}
}
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) { }
}
}
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
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
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