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

Simplest example doesn't work #1099

Open
LexaGV opened this issue Aug 6, 2024 · 0 comments
Open

Simplest example doesn't work #1099

LexaGV opened this issue Aug 6, 2024 · 0 comments

Comments

@LexaGV
Copy link

LexaGV commented Aug 6, 2024

Environment

NetMQ Version: latest at 6 Aug (probably 4.0.0.0 as *.csproj says).
Built from sources for .NET FW 4.8
Operating System: Win7 x64 SP1
.NET Version: Framework 4.8

Sample is:

var server = new ResponseSocket("@tcp://localhost:5556");

Fails with error:

Unexpected null of type AsyncSocket
at NetMQ.Assumes.NotNull[T](T o) in C:\PRG\NetMQ_project\NetMQ\Utils\Assumes.cs:line 12
at NetMQ.Core.Transports.Tcp.TcpListener.SetAddress(String addr) in C:\PRG\NetMQ_project\NetMQ\Core\Transports\Tcp\TcpListener.cs:line 126
at NetMQ.Core.SocketBase.Bind(String addr) in C:\PRG\NetMQ_project\NetMQ\Core\SocketBase.cs:line 569
at NetMQ.NetMQSocket.Bind(String address) in C:\PRG\NetMQ_project\NetMQ\NetMQSocket.cs:line 188
at NetMQ.NetMQSocket..ctor(ZmqSocketType socketType, String connectionString, DefaultAction defaultAction) in C:\PRG\NetMQ_project\NetMQ\NetMQSocket.cs:line 65
at NetMQ.Sockets.ResponseSocket..ctor(String connectionString) in C:\PRG\NetMQ_project\NetMQ\Sockets\ResponseSocket.cs:line 17
...

If you look at SetAddress(TcpListener.cs line 121), it's smth strange: the only place where m_handle is initialized is line 130:

m_handle = AsyncSocket.Create(m_address.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);

...but immediately before this line you check:

Assumes.NotNull(m_handle);

What?? How you can check it's not null if you never initialized it? Seems somebody too anxious for "null" value that forgot business logic - main thing he should worry about.

After elementary fix (remove illogical Assert) server at least started.

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

1 participant