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.NullReferenceException: Object reference not set to an instance of an object #50

Open nesa24 opened 8 years ago

nesa24 commented 8 years ago

System.NullReferenceException: Object reference not set to an instance of an object. at FMScoutFramework.Core.FMCore.GetListFromStore[T]()

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

shiro900 commented 8 years ago

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.

ThanosSiopoudis commented 8 years ago

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

fmcore.GameLoaded += new Action(GameLoaded);

...

public void GameLoaded() {
...
}