| Bug #24957 | MySql.Data.Types.MySqlConversionException is not marked as Serializable. | ||
|---|---|---|---|
| Submitted: | 11 Dec 2006 16:40 | Modified: | 27 Feb 2007 12:24 |
| Reporter: | John Vanderburg | ||
| Status: | Closed | ||
| Category: | Connector/Net | Severity: | S3 (Non-critical) |
| Version: | 5.0.2 | OS: | Microsoft Windows (Win XP SP2) |
| Assigned to: | Target Version: | ||
| Tags: | remoting, date, time, exception | ||
[11 Dec 2006 16:40]
John Vanderburg
[2 Jan 2007 17:49]
John Vanderburg
Finally had some time to do some testing. Adding [Serializable] isn't enough. It also
requires a Serialization constructor. The following works:
using System;
using System.Security.Permissions;
using System.Runtime.Serialization;
namespace MySql.Data.Types
{
/// <summary>
/// Summary description for MySqlConversionException.
/// </summary>
[Serializable]
public class MySqlConversionException : ApplicationException
{
/// <summary>Ctor</summary>
public MySqlConversionException(string msg)
: base(msg)
{
}
[SecurityPermission(SecurityAction.LinkDemand,
Flags=SecurityPermissionFlag.SerializationFormatter)]
protected MySqlConversionException(SerializationInfo info, StreamingContext
context)
: base(info, context)
{
}
}
}
[2 Jan 2007 17:55]
Tonci Grgin
Hi John and thanks for your problem report. For the sake of completeness, please provide following: - NET FW version - Small but complete test case presenting this error - MySQL server version
[4 Jan 2007 21:19]
John Vanderburg
Tonci: Sorry about that. Here's the version info: MySQL Server version 5.0.27-standard-log via TCP/IP .NET version 2.0.50727 I'll come up with a short program to reproduce the error. I think I can do it using application domains so you won't have to mess with any remoting set issues. I many not be able to get to it until next week, but again the issue isn't critical. Thanks
[5 Jan 2007 8:46]
Tonci Grgin
OK John, I'm waiting. It is realy hard to tell what's going on without proper test case since, sometimes, one can use choose execution paths/environments not exhibiting error at all.
[9 Jan 2007 4:59]
John Vanderburg
Programs to recreate issue.
Attachment: bug-24957-example.txt (text/plain), 6.89 KiB.
[9 Jan 2007 5:07]
John Vanderburg
Tonci:
I've attached a file with programs to recreate the issue. Follow the instructions in the
file on how to split out the two programs and compile them.
The program doesn't do any database access since the issue is with the .NET exception
implementation, it just shows what happens when the MySqlConversionException is throw in a
remote object.
The issue occurs in following routine of the 2nd (the exe) program. It should catch the
MySqlConversionException that is thrown in the remote application domain, but it doesn't.
Please let me know if you need anything else of have any questions.
Thanks
/// <summary>
/// Call the remote method and tell it to throw MySqlConversionException.
/// We should catch the MySqlConversionException, however, because it doesn't
/// handle serialization, we get a different exception.
/// </summary>
public void BugTest()
{
Console.WriteLine(_divider);
Console.WriteLine(" Test using MySqlConversionException");
Console.WriteLine(_divider);
try
{
// Invoke the method
_remoteInstance.ThrowIt(false);
Console.WriteLine("No exception occured in remote method.");
}
catch(MySqlConversionException cnvEx)
{
Console.WriteLine("MySqlConversionException occured in remote method. Message:
{0}", cnvEx.Message);
}
catch(Exception ex)
{
Console.WriteLine("Other occured in remote method. Details: {0}", ex);
}
}
[15 Jan 2007 7:51]
Tonci Grgin
Thanks John.
[22 Feb 2007 21:55]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/20421
[22 Feb 2007 21:56]
Reggie Burnett
Fixed in 5.0.4 and 1.0.10
[22 Feb 2007 21:57]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/20422
[27 Feb 2007 12:24]
MC Brown
A note has been added to the 5.0.4 and 1.0.10 changlogs.
