Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 903645 - Last Review: May 21, 2007 - Revision: 1.4
BUG: A System.NullReferenceException exception occurs when an instance of a DataSet typed object is serialized when multiple threads access the same instance of a DataSet typed object synchronously
When an instance of a
DataSet typed object is serialized
when multiple threads are accessing the same instance synchronously, a
System.NullReferenceException exception may occur. The typical call stack is similar to the
following:
at System.Data.DataTable.System.Runtime.Serialization.ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.SerializeResponse(IServerResponseChannelSinkStack sinkStack, IMessage msg, ITransportHeaders& headers, Stream& stream)
at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)
This problem occurs when the
DataTable typed object does not have
the
DataSet member set to an instance of a
DataSet typed
object
This problem occurs because the
GetObjectData method that serializes a
DataTable typed object uses specific
methods of the
DataSet class. If the
DataTable typed object does not have the
DataSet member set to an instance of a
DataSet typed object, the
DataTable typed object will temporarily add or remove the
DataSet object.
However, the addition or removal of this temporary
DataSet object cannot be
performed synchronously.
To work around this problem, you can add a
DataSet member to the
DataTable typed object. The
DataSet member is set to an instance of the
DataSet typed
object. For example, locate the following line of code.
myTable = new DataTable("Names");Then add the following lines of code after the previous code.
DataSet myDS = new DataSet("MyDataSet");
myDS.Tables.Add(myTable);
Microsoft has confirmed that this is a bug in the Microsoft
products that are listed in the "Applies to"
section.
For more information about the
DataTable class, visit the
following Microsoft Developer Network (MSDN) Web site:
APPLIES TO
- Microsoft .NET Framework 1.1
- Microsoft .NET Framework 1.0
- Microsoft ADO.NET 1.1
- Microsoft ADO.NET 1.0
| kberrmsg kbtshoot kbbug KB903645 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
Be the first to leave feedback, to help others about this knowledge base
article.
(Optional) Name
(Optional)
Public URL Or Email
Comments
No
HTML -- Text Only Please