OverlappedAsyncResult what class uses this?

  • Thread starter Thread starter Muscha
  • Start date Start date
M

Muscha

Hello,

I have the following exception in my app, have been chasing it up for the
past few days none to avail. Help does anyone know what this may be?

Unhandled Exception: System.IO.IOException: Unable to read data from the
transpo
rt connection. ---> System.ObjectDisposedException: Cannot access a disposed
obj
ect.
at System.Threading.ManualResetEvent.Reset()
at System.Net.Connection.ReadCallback(IAsyncResult asyncResult)
--- End of inner exception stack trace ---
at System.Net.Connection.ReadCallback(IAsyncResult asyncResult)
at System.Net.LazyAsyncResult.InvokeCallback()
at System.Net.LazyAsyncResult.InvokeCallback(Boolean
completedSynchronously,
Object result)
at System.Net.Sockets.OverlappedAsyncResult.CompletionPortCallback(UInt32
err
orCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)

thanks,

/m
 
Got it. Post it here so if other people search for it will be found.

I am using XmlDocument.LoadXml(...) this apparently validate the DTD and
tried to download the DTD as well. My gut feel is that since the nature of
our applicatoin has hundreds of thousands of objects created in a short
amount of time, the validating of DTD is using an ansynchrounous process or
some sort. And internally it's using weak reference thus when the result
came back it throws the ObjectDisposedException.

Hmmph not sure if this is true or not, like I said this is just a gut feel
:) I didn't know c# well enough :) Anyway I disable the checking of the DTD
and this exception dissapear.


/m
 
To add to your response.
Overlapped IO is a win32 async IO model, in this case it appears to be using
Completion Ports, which is a type of async commuincation model often used in
networking apps(although they can work on files, IIRC). The exception
appears to be occuring in a CompletionPort callback where a ManualResetEvent
somewehre is being disposed before the loading is complete. If you need
validation, you may want to read the entire stream into memory yourself (via
StreamReader or something) and then loading it into the XmlDocument from the
local stream.
This code most likely exists in most, if not all System.Net calls, its odd
that this is occuring in your case, can you repo it in another case?
 
To add to your response.
Overlapped IO is a win32 async IO model, in this case it appears to be using
Completion Ports, which is a type of async commuincation model often used in
networking apps(although they can work on files, IIRC). The exception
appears to be occuring in a CompletionPort callback where a ManualResetEvent
somewehre is being disposed before the loading is complete. If you need
validation, you may want to read the entire stream into memory yourself (via
StreamReader or something) and then loading it into the XmlDocument from the
local stream.
This code most likely exists in most, if not all System.Net calls, its odd
that this is occuring in your case, can you repo it in another case?

Hmm not really, this is where it happens at the moment. The way I do this
XmlDocument loading is like this:

- download the document.
- store the document
- load from store
- load string into XmlDocument object.

I know XmlDocument can load using the stream, but for our case we needed the
document to be downloaded first, stored and then reload it as XmlDocument.

/m
 
Muscha said:
used

Hmm not really, this is where it happens at the moment. The way I do this
XmlDocument loading is like this:

- download the document.
- store the document
- load from store
- load string into XmlDocument object.

I know XmlDocument can load using the stream, but for our case we needed the
document to be downloaded first, stored and then reload it as XmlDocument.

Ahh, I see. Does the document have a schema reference that an XmlResolver
may be trying to resolve?
 
Hmm not really, this is where it happens at the moment. The way I do
this
Ahh, I see. Does the document have a schema reference that an XmlResolver
may be trying to resolve?

Yes it does, however it escapes me how it can throw object disposed
exception .. ?

/,
 
Muscha said:
Yes it does, however it escapes me how it can throw object disposed
exception .. ?

Well, the exact reasoning is not clear to me either, if you dig down into
the framework with Reflector you might be able to determine it, but it may
be a framework issue. It is possible that somewhere down deep in the system
there is a bug that is referencing a disposed object on the return of an
async call, however it is potentially due to user error(however, logically,
that kind of error should probably be handled in the class and thrown as a
more descriptive error).
 
Back
Top