Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot access a disposed object #296

Open
anyway2019 opened this issue Apr 23, 2024 · 4 comments
Open

Cannot access a disposed object #296

anyway2019 opened this issue Apr 23, 2024 · 4 comments

Comments

@anyway2019
Copy link

the env:

net6.0-windows WPF

the version of NetCoreServer:

6.7.0

the stack trace:

Application: PowerFunRowerNet.exe CoreCLR Version: 6.0.2123.36311 .NET Version: 6.0.21 Description:
The process was terminated due to an unhandled exception. 
Exception Info: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'System.Net.Sockets.Socket'. at System.Net.Sockets.Socket.ThrowObjectDisposedException() at System.Net.Sockets.Socket.get_RemoteEndPoint() 
at PowerFunRowerNet.Network.TcpService.PfTcpSession.OnConnected() in E:\pf\powefun-rower-net\Network\TcpService.cs:line 116 at NetCoreServer.TcpSession.Connect(Socket socket) at NetCoreServer.TcpServer.ProcessAccept(SocketAsyncEventArgs e) 
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- 
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pNativeOverlapped)

the log is :

2024-04-22 21:16:34.822 +08:00 [ERR] OnConnected
2024-04-22 21:16:34.822 +08:00 [ERR] OnDisconnected

it seems the issue that connect event and disconnect envent trigger at same time still exsits in 6.7.0

@iBoundary
Copy link

I also encountered this issue. Have you resolved it now? @anyway2019 @chronoxor

@anyway2019
Copy link
Author

I also encountered this issue. Have you resolved it now? @anyway2019 @chronoxor

not yet,i just add try catch block.

@ilsnk
Copy link

ilsnk commented Jun 4, 2024

We have a similar case

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.Socket'.
   at System.Net.Sockets.Socket.ThrowObjectDisposedException()
   at System.Net.Sockets.Socket.Send(ReadOnlySpan`1 buffer, SocketFlags socketFlags, SocketError& errorCode)
   at NetCoreServer.TcpSession.Send(ReadOnlySpan`1 buffer) in /src/websocket-server/NetCoreServer/TcpSession.cs:line 283
   at NetCoreServer.WsSession.SendBinary(ReadOnlySpan`1 buffer) in /src/websocket-server/NetCoreServer/WsSession.cs:line 74

@ilsnk
Copy link

ilsnk commented Aug 7, 2024

@anyway2019 maybe you want contribute this action?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants