ThanosSiopoudis / FMScoutFramework

A Real-Time Football Manager scout tool framework written in .NET/Mono for Windows/Linux/OS X
GNU General Public License v2.0
73 stars 26 forks source link

System.ArgumentOutOfRangeException was unhandled by user code #53

Open SeeInSeeOut opened 8 years ago

SeeInSeeOut commented 8 years ago

Hi,

I'd used this framework when it was originally released, and come across some work I'd done in 2009 on an old hard drive....so pleased to see the framework is still being developed!

I read through the readme to try make this work with FM 2015 (v15.3.2) however I'm experiencing an error when just having a button to load data on a form.

Using visual studio 2015 Ent.

System.ArgumentOutOfRangeException was unhandled by user code
  HResult=-2146233086
  Message=Non-negative number required.
Parameter name: capacity
  ParamName=capacity
  Source=mscorlib
  StackTrace:
       at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
       at System.Collections.Generic.List`1..ctor(Int32 capacity)
       at FMScoutFramework.Core.Managers.ObjectManager.GetMemoryAddresses(Int32 firstAddress, Int32 numberOfObjects) in C:\Users\X\Source\Repos\FMScoutFramework\VirtualMemory\Managers\ObjectManager.cs:line 261
       at FMScoutFramework.Core.Managers.ObjectManager.GetMemoryAddresses(Expression`1 baseObjectPointer, Func`2 compiledObjectPointer) in C:\Users\X\Source\Repos\FMScoutFramework\VirtualMemory\Managers\ObjectManager.cs:line 248
       at FMScoutFramework.Core.Managers.ObjectManager.RetrieveObjectRealtime[T](Expression`1 baseObjectPointer, Func`2 compiledObjectPointer, List`1 memoryAddresses) in C:\Users\X\Source\Repos\FMScoutFramework\VirtualMemory\Managers\ObjectManager.cs:line 184
       at FMScoutFramework.Core.Managers.ObjectManager.RetrieveObjects[T](Expression`1 baseObjectPointer, Func`2 compiledObjectPointer, List`1 memoryAddresses) in C:\Users\X\Source\Repos\FMScoutFramework\VirtualMemory\Managers\ObjectManager.cs:line 178
       at FMScoutFramework.Core.Managers.ObjectManager.RetrieveObjects[T](Expression`1 baseObjectAddress, Func`2 compiledObjectPointer) in C:\Users\X\Source\Repos\FMScoutFramework\VirtualMemory\Managers\ObjectManager.cs:line 164
       at FMScoutFramework.Core.Managers.ObjectManager.Load(Boolean refreshPersonCache) in C:\Users\X\Source\Repos\FMScoutFramework\VirtualMemory\Managers\ObjectManager.cs:line 49
       at FMScoutFramework.Core.FMCore.LoadDataForCheckedGame(Boolean refreshPersonCache) in C:\Users\X\Source\Repos\FMScoutFramework\FMCore.cs:line 73
       at FMScoutFramework.Core.FMCore.LoadData(Boolean refreshPersonCache) in C:\Users\X\Source\Repos\FMScoutFramework\FMCore.cs:line 53
       at FMScoutFramework.Core.FMCore.LoadData() in C:\Users\X\Source\Repos\FMScoutFramework\FMCore.cs:line 47
       at FMScoutiee.Form1.<loadData_Click>b__2_0() in C:\Users\X\Documents\Visual Studio 2015\Projects\FMScoutiee\FMScoutiee\Form1.cs:line 29
       at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
       at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
  InnerException: 
ThanosSiopoudis commented 7 years ago

What operating system please? Is this for Windows? I'll also need to see the code that handles the button click and loading call to the framework

SeeInSeeOut commented 7 years ago

Windows

Currently just a form with a button on it.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Windows.Forms;
using FMScoutFramework.Core;
using FMScoutFramework.Core.Entities.InGame;
using System.Diagnostics;

namespace FMScoutiee
{

    public partial class Form1 : Form
    {
        public FMCore fmCore = new FMCore(FMScoutFramework.Core.Entities.DatabaseModeEnum.Realtime);
        public Form1()
        {
            InitializeComponent();
        }

        private void loadData_Click(object sender, EventArgs e)
        {
            fmCore.GameLoaded += new Action(GameLoaded);
            new Action(() => fmCore.LoadData()).BeginInvoke((s) => { }, null);
        }

        public void GameLoaded()
        {
            Debug.WriteLine("Load Done");
        }
    }

}
SeeInSeeOut commented 7 years ago

Any idea ThanosSiopoudis?

ThanosSiopoudis commented 7 years ago

@SeeInSeeOut it is most likely an incompatibility in the framework with the version you are using. Is it from Steam?

SeeInSeeOut commented 7 years ago

Yes its from Steam.

15.3.2 627042 (m.e v1555)