Last post Oct 24, 2017 08:02 AM by lappel
Oct 19, 2017 05:15 AM|lappel|LINK
please help me, i see an eror.
Cannot access a disposed object. Object name: 'System.Net.Sockets.NetworkStream'.
please help me to solve this eror..
Oct 19, 2017 06:18 AM|PatriceSc|LINK
You likely try to use a NetworkStream object that has been closed previously. Check your code for that.
Usually you try to fix a problem from both the error and where it happens. If you log exception.Message try yo log exception.ToString() insteadf which will include the "call stack" information.
Oct 19, 2017 07:24 AM|lappel|LINK
ok, i will try. let me know the first step what should i check.
Oct 19, 2017 01:21 PM|PatriceSc|LINK
That you don't have something such as :
myNetworkStream.Close(); // Close the network stream
myNetworkStream.<MethodCall>(); // Still use it despite being closed
Wehn debugging you should always start from a full error message that also includes where the error happen (at least the method name). I suspect you are using exception.Message that shows just the error message rather than exception.ToString() that have
the full information from which to start when debugging your code.
Oct 20, 2017 06:00 AM|Eric Du|LINK
According to your description and error message, this issue maybe caused by you close the stream when you want to access it, also may be you can not get the stream. I suggest you debug your code, which the stream!
But if you can not solve the problem, please post your code and detailed description of your operations, this will better help you to solve the problem.
Oct 24, 2017 08:02 AM|lappel|LINK
Thank you Patrice for that solution.