Aug 5, 2010 at 11:05 AM
Hi, I've been posted a big bug in issue tracker but I can not grow the impact. Can you tell me if you have an idee of resolution of the bug. Thanks, Victor
Aug 7, 2010 at 8:10 AM

It is not big issue,your code is wrong.

At first,for preventing timeout You can change timeout minute by setting Pop3Client object.
You can find old discussions how to set it.

And you make sure that check the return value of Authenticate method.
It will be raise exception when call ExecuteUidl method before authenticated.

You must take a time to understand dispose and using syntax architecture.
Your code sometimes leak OS resource.
This page is very good article about dispose .


Aug 7, 2010 at 2:30 PM


Thanks for your answer.

In fact, i forgot to test the return value of Authenticate method.

But it's not normal that the program ends without an explanation by Debugger.

Must I use pop.Dispose(); instead of pop.Close(); ?



Aug 9, 2010 at 3:08 PM
Edited Aug 9, 2010 at 3:22 PM

If Authenticate method raise exception after open connection(inside this method),TcpClient object will be leak system resource because you don't release system resource in last finnally block.
I'm not sure what happen in your environment,but it seems that the continuous leak in this line may cause suddenly ends your program.
In basic theory,all .net object which implement IDisposable interface must be called dispose method in finally block to release system resources(like file handle,network socket...ect).
More complicated case is exist such as share object or multi thread environment, but in simple usecase it is a simple theory we must belong.
You can call Close method instead of Dispose method because Close method call Dispose method inside of it.


Aug 9, 2010 at 3:33 PM


In my case Authenticate doesn't throw an Exception.

If you omit to call Authenticate with the same code, you've got the same thing.

The crash is due to the proxy of the school that blocks Authenticate.

So if the program doesn't check the result of Authenticate and fail the Authentication, the program continue to execute code and crash.

For your library, Must I call Dispose method manually for each class ?

You are saying that in a managed World I must free the memory myself with complex .NET object ?



Aug 9, 2010 at 3:48 PM
Edited Aug 9, 2010 at 3:49 PM

OK.Thank you for your information.

The answer for your question

1--You must call dispose method for each class that implement IDisposable interface.

2--And you must free OS resource (not memory) with dispose method in manage world.

And I recomment you that get a time to study about interface,reference,Dispose,OS resource,gabage collection.

I'll check my code and report this issue.

Please wait for few days.

Thank you.

Aug 9, 2010 at 9:58 PM


Thanks, for those details.

I will take look at IDisposable interface and his consequences in the code. The concept is new for me because I'm comming from C++.

You can delete my issue if you see the bug (I can't myself).



Aug 19, 2010 at 12:27 PM

In close method,Pop3Client object execute quit command to pop3 server.
In your situation,receive timeout occur and the connection disconnected,after that Close method is called.
Beside the connection is disconnected,the quit command is failed and raise exception during Close method executing.

I change the specification.
I remove the line that executing quit command inside close method and now you can correctly execute your program.

Thank you very much for your information.