-
Notifications
You must be signed in to change notification settings - Fork 18
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
Exception thrown: 'System.IndexOutOfRangeException' in PhotonPackageParser.dll #11
Comments
Same problem here: System.IndexOutOfRangeException: 'Index was outside the bounds of the array.' What can we do? |
same here. |
@bonesoul Nope. Just try catch. :/ |
i got a same problem,Can u send me some email or discord? |
Hello. This occurs when processing custom packages. They cannot be processed. The solution is try/catch at the parser call site. |
i attempt to try/catch at the parser call site like this |
try
{
var packet = Packet.ParsePacket(e.GetPacket().LinkLayerType, e.GetPacket().Data).Extract();
if (packet != null && (packet.SourcePort == 7656 || packet.DestinationPort == 7656))
{
Console.WriteLine("packet: " + packet.PayloadData.Length);
_receiver.ReceivePacket(packet.PayloadData);
}
}
catch (Exception exc)
{
ConsoleManager.WriteLineForError(MethodBase.GetCurrentMethod()?.DeclaringType, exc);
Log.Error(nameof(Device_OnPacketArrival), exc);
}
I've printed the lengths of the packet.PayloadData. This is the prints.
packet: 58
Exception thrown: 'System.IndexOutOfRangeException' in PhotonPackageParser.dll
packet: 44
Exception thrown: 'System.IndexOutOfRangeException' in PhotonPackageParser.dll
packet: 236
Why is it throwing this exception?
The text was updated successfully, but these errors were encountered: