I'm trying to create my first Advanced Robot in C# (.NET 4.5). It runs fine until some statements. This code:
public override void Run() { while (true) { SetTurnRadarRightRadians(Double.PositiveInfinity); Execute(); } }
instantly throws following exception:
System.InvalidCastException: Unable to cast object of type 'net.sf.robocode.dotnet.host.proxies.StandardRobotProxy' to type 'Robocode.RobotInterfaces.Peer.IAdvancedRobotPeer'.
at Robocode.AdvancedRobot.SetTurnRadarRightRadians(Double radians)
at SOA.MrTank.Run()
at net.sf.robocode.dotnet.host.proxies.HostingRobotProxy.CallUserCode()
at net.sf.robocode.dotnet.host.proxies.HostingRobotProxy.run()
SetAhead, TurnRadarRight statements produce the same outcome, but SetFire seems to be working fine.
I googled it for several hours and haven't found anything useful about it.
What am I doing wrong here?
Anonymous
I will have a look at the issue tonight. It might be a bug in the .NET plugin for Robocode.
Let's see.
I have tried to reproduce the problem using Robocode 1.9.2.5 with the .NET plugin for 1.9.2.5 installed. I have used Visual Studio Community 2015 and built SOA.MyTank using .NET Framework 3.5 and 4.5.
I am not able to reproduce the problem you see!?
This is the source code I have been using to test the issue you see:
Wow. It's some kind of magic, but now I can't replicate the error too! Really odd. Might had something to do with a robocode application.
Thank you very much and sorry for your lost time!
Don't be sorry. You are right. There may be a bug in Robocode.
Write again if you encounter this issue again and is able to reproduce it.