Comments (6)
This exception is most likely raised by string.Substring
method in Connection.cs
file. https://stackoverflow.com/questions/5633661/length-cannot-be-less-than-zero-on-a-blank-line
Need to attach a debugger and observe which command raises the exception.
from xna-cncnet-client.
21.07. 15:37:15.632 Unable to connect to the server. Length cannot be less than zero. (Parameter 'length')
at System.String.ThrowSubstringArgumentOutOfRange(Int32 startIndex, Int32 length)
at System.String.Substring(Int32 startIndex, Int32 length)
at DTAClient.Online.Connection.HandleMessage(String message) in C:\Users\p\Desktop\CNCNET CLIENT STUFF\xna-cncnet-client\DXMainClient\Online\Connection.cs:line 515
at DTAClient.Online.Connection.HandleComm() in C:\Users\p\Desktop\CNCNET CLIENT STUFF\xna-cncnet-client\DXMainClient\Online\Connection.cs:line 276
at DTAClient.Online.Connection.ConnectToServer() in C:\Users\p\Desktop\CNCNET CLIENT STUFF\xna-cncnet-client\DXMainClient\Online\Connection.cs:line 204
from xna-cncnet-client.
diff --git a/DXMainClient/Online/Connection.cs b/DXMainClient/Online/Connection.cs
index ba1341ba..f8e8c570 100644
--- a/DXMainClient/Online/Connection.cs
+++ b/DXMainClient/Online/Connection.cs
@@ -499,7 +499,7 @@ namespace DTAClient.Online
/// <param name="message">The message.</param>
private void HandleMessage(string message)
{
- string msg = overMessage + message;
+ string msg = overMessage + message.Trim();
overMessage = "";
while (true)
{
from xna-cncnet-client.
Need to attach a debugger and observe which command raises the exception.
+1.
Printing stacktrace might be also helpful:
- Logger.Log("Unable to connect to the server. " + ex.Message);
+ Logger.Log("Unable to connect to the server. " + ex.Message + "\n" + ex.StackTrace);
from xna-cncnet-client.
private void HandleMessage(string message)
{
string msg = overMessage + message;
overMessage = "";
while (true)
{
int commandEndIndex = msg.IndexOf("\n");
if (commandEndIndex == -1) whatever;
else if (msg.Length != commandEndIndex + 1)
{
// throw exception here? so commandEndIndex is 0?
string command = msg.Substring(0, commandEndIndex - 1);
from xna-cncnet-client.
Seems like HandleMessage(message)
would fail when message
ends up with "\n"
from xna-cncnet-client.
Related Issues (20)
- Replace TAL.DE.EU.GameSurge.net with LAN-Team.DE.EU.GameSurge.net HOT 5
- Please give us back Observers on Coop missions
- Favorite maps disappearing
- CnCNet Client WebSocket Support
- Will the 2.8.0.3 branch merge into the develop branch?
- Will it be updated to .NET8?
- VS issue with building, and can't start after compiling - file not found HOT 2
- YR - Players cannot select Germany faction when "No Yuri/No France" is enabled HOT 2
- Could not find required child control: PlayerOptionsPanel Could a pro please provide specific guidance on what to do? HOT 2
- Use Central Package Management
- Replace WebClient and WebRequest to HttpClient
- Support FinalSun/FinalAlert from Steam HOT 2
- IME support for East Asia users
- Reimplement/remove favourite maps feature
- Move SecondStageUpdater directory HOT 2
- Checking for update fails if the update mirror URL does not end with a trailing slash
- repo webhook test HOT 1
- Correct the updater path in docs
- "Start New Game" doing nothing :( HOT 1
- Running MentalOmega on WINE in 64 bit mac
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xna-cncnet-client.