FMScoutFramework icon indicating copy to clipboard operation
FMScoutFramework copied to clipboard

System.NullReferenceException: Object reference not set to an instance of an object

Open nesa24 opened this issue 8 years ago • 2 comments

System.NullReferenceException: Object reference not set to an instance of an object. at FMScoutFramework.Core.FMCore.GetListFromStoreT

setup solution as in http://www.fmscout.com/a-fmscout-framework.html for visualstudio

builded dll and app

when debugging it points me to

> FMScoutFramework.dll!FMScoutFramework.Core.FMCore.GetListFromStore<FMScoutFramework.Core.Entities.InGame.Player>() Line 41 C# and that is

private IQueryable<T> GetListFromStore<T>()
        {
            return ((Dictionary<int, T>)objectManager.ObjectStore [typeof(T)]).Values.AsQueryable ();
        }

objectManager is null any help please

nesa24 avatar Mar 10 '16 17:03 nesa24

You have to use Thread.Sleep(1000); before you call something like var list = fmCore.Clubs.ToList(); because the loading is running async and it needs time to load.

shiro900 avatar Apr 24 '16 02:04 shiro900

There is a better example with callbacks in the Readme.md file. Use something like

fmcore.GameLoaded += new Action(GameLoaded);

...

public void GameLoaded() {
...
}

ThanosSiopoudis avatar Apr 24 '16 09:04 ThanosSiopoudis