Closed GoogleCodeExporter closed 9 years ago
Good thinking! Revision 94 now logs error in release instead of throwing
exception
Original comment by lidg...@gmail.com
on 10 Aug 2010 at 11:22
http://code.google.com/p/lidgren-network-gen3/source/browse/trunk/Lidgren.Networ
k/NetPeer.Internal.cs?spec=svn94&r=94#142
throw new Exception("borak!");
I think it was not supposed to be.
#if DEBUG
catch(Exception ex)
{
throw;
}
#else
First you can just use catch { throw; }
Second, you must not throw exception from thread even in Debug because it
aborts the program :(
Original comment by NN1436401@gmail.com
on 10 Aug 2010 at 11:35
Yes; I accidently left some testing code in; patched it 30 seconds later tho in
r95. In debug you want an exception to be thrown to be able to debug the
problem; the debugger will break and you can inspect various threads.
Original comment by lidg...@gmail.com
on 10 Aug 2010 at 11:47
I disagree with you about debug mode.
I run program with debugger and when it reaches throw; I get "SocketException
was unhandled" and I cannot continue running my program.
If you want to point a user out in the debug about error, you should use
System.Diagnostics.Debug.Fail.
Original comment by NN1436401@gmail.com
on 10 Aug 2010 at 12:00
What's the point of continuing running the program? Since initialization failed
unexpectedly we cannot keep the network thread alive and for a networked app I
don't see the point in continuing.
Swallowing the exception in RELEASE is bad enough, but since there's no way of
catching it easily it's the only way. In DEBUG however you'd want to break as
early as possible.
The only almost-valid case I see is probing to see if the port is already in
use; I should probably create a utility method for that.
Original comment by lidg...@gmail.com
on 10 Aug 2010 at 12:30
What about case of trying some different end points ? I mean if you try the
first one and if it fails moves to another one.
Throwing exception there just aborts the program and doesn't allow me to handle
it in any way.
Is it possible to move binding socket outside the thread ?
Than you just throw exception in the same thread where Start is called.
Everyone is happy.
Original comment by NN1436401@gmail.com
on 10 Aug 2010 at 12:52
Hmm, yes binding on main thread could be a good idea. I'll do some testing and
make it so unless there's other issues.
Original comment by lidg...@gmail.com
on 10 Aug 2010 at 1:12
Original issue reported on code.google.com by
NN1436401@gmail.com
on 10 Aug 2010 at 10:28