D
Dean Bostic
On August 19, 2003, a reader discovered that he couldn't
deserialize an OracleException. He began a thread with
Scot Rose of Microsoft where he described the nature of
the problem. The reader wrote,
"We have narrowed it down to the constructor
OracleException
(System.Runtime.Serialization.SerializationInfo
si,System.Runtime.Serialization.StreamingContext sc),
which looks for
members "message" and "source", but the GetObjectData
(...) method in the
base (System.Exception) uses the strings "Member"
and "Source". Since the
element lookup in SerializationInfo is case sensistive,
GetElement() and
FindElement() fail and the OracleException deserialize
throws an exception."
Scot Rose asked for a small project and the reader
provided one. There is no record of a response from MS.
So here's another project, a console app, that
demonstrates the problem. I am running framework 1.0
with a "hotfix" version of System.Data.OracleClient.dll,
version 1.0.1088.0 that fixes some of the MANY bugs in
this provider.
Can someone from MS follow-up on this bug and provide a
work-around?
Imports System.IO
Imports System.Data.OracleClient
Imports System.Runtime.Serialization
Imports System.Runtime.Serialization.Formatters.Binary
Module Module1
Sub Main()
Dim conn As New OracleConnection("Data
Source=ussxt6;User Id=foresight_mcp;Password=xxx")
Dim cmd As New OracleCommand("select * from
blah_blah", conn) ' will throw "Table or View does not
exist"
Dim reader As OracleDataReader
Try
conn.Open()
reader = cmd.ExecuteReader()
Catch e As OracleException
Dim formatter As New BinaryFormatter()
Dim stream As Stream = File.Open
("c:\temp\foo.bin", IO.FileMode.Create,
IO.FileAccess.ReadWrite)
formatter.Serialize(stream, e)
stream.Close()
stream = File.Open("c:\temp\foo.bin",
FileMode.Open, FileAccess.Read)
Try
Dim obj As Object = formatter.Deserialize
(stream)
Catch xx As Exception
MsgBox(xx.ToString())
End Try
Dim phoenix As OracleException = CType
(formatter.Deserialize(stream), OracleException)
MsgBox(phoenix.ToString())
Finally
If Not reader Is Nothing Then reader.Close()
If Not conn Is Nothing Then conn.Close()
End Try
End Sub
End Module
deserialize an OracleException. He began a thread with
Scot Rose of Microsoft where he described the nature of
the problem. The reader wrote,
"We have narrowed it down to the constructor
OracleException
(System.Runtime.Serialization.SerializationInfo
si,System.Runtime.Serialization.StreamingContext sc),
which looks for
members "message" and "source", but the GetObjectData
(...) method in the
base (System.Exception) uses the strings "Member"
and "Source". Since the
element lookup in SerializationInfo is case sensistive,
GetElement() and
FindElement() fail and the OracleException deserialize
throws an exception."
Scot Rose asked for a small project and the reader
provided one. There is no record of a response from MS.
So here's another project, a console app, that
demonstrates the problem. I am running framework 1.0
with a "hotfix" version of System.Data.OracleClient.dll,
version 1.0.1088.0 that fixes some of the MANY bugs in
this provider.
Can someone from MS follow-up on this bug and provide a
work-around?
Imports System.IO
Imports System.Data.OracleClient
Imports System.Runtime.Serialization
Imports System.Runtime.Serialization.Formatters.Binary
Module Module1
Sub Main()
Dim conn As New OracleConnection("Data
Source=ussxt6;User Id=foresight_mcp;Password=xxx")
Dim cmd As New OracleCommand("select * from
blah_blah", conn) ' will throw "Table or View does not
exist"
Dim reader As OracleDataReader
Try
conn.Open()
reader = cmd.ExecuteReader()
Catch e As OracleException
Dim formatter As New BinaryFormatter()
Dim stream As Stream = File.Open
("c:\temp\foo.bin", IO.FileMode.Create,
IO.FileAccess.ReadWrite)
formatter.Serialize(stream, e)
stream.Close()
stream = File.Open("c:\temp\foo.bin",
FileMode.Open, FileAccess.Read)
Try
Dim obj As Object = formatter.Deserialize
(stream)
Catch xx As Exception
MsgBox(xx.ToString())
End Try
Dim phoenix As OracleException = CType
(formatter.Deserialize(stream), OracleException)
MsgBox(phoenix.ToString())
Finally
If Not reader Is Nothing Then reader.Close()
If Not conn Is Nothing Then conn.Close()
End Try
End Sub
End Module