[Help] 5095 Error(s)

12/11/2011 17:14 killersub#1
I am still developing the Elite-CoEmu source because I want to use it as a base source and continue from there, but ofc I run into some errors when the world server is executed:

Code:
== Welcome to Elite-CoEmu v5095 ==
== This Program is for Non Profitable and Entertainment Purposes Only ==
[WorldServer] Starting to Initialize
System.NullReferenceException: Object reference not set to an instance of an object.
   at MySqlHandler.MySqlReader.Read()
   at WorldServer.Database.LoadMaps() in C:\Users\LaZaRo\Desktop\Elite Co-Emu\trunk\WorldServer\Database\Database.cs:line 938
[WorldServer] Loaded 0 Maps in 733ms
System.NullReferenceException: Object reference not set to an instance of an object.
   at MySqlHandler.MySqlReader.Read()
   at WorldServer.Database.LoadDynamicMaps() in C:\Users\LaZaRo\Desktop\Elite Co-Emu\trunk\WorldServer\Database\Database.cs:line 964
   at WorldServer.Initialize.LoadMaps() in C:\Users\LaZaRo\Desktop\Elite Co-Emu\trunk\WorldServer\Initialize.cs:line 28
   at WorldServer.World.StartServer() in C:\Users\LaZaRo\Desktop\Elite Co-Emu\trunk\WorldServer\World.cs:line 151
Database.cs line 938:
Code:
public static void LoadMaps()
        {
            try
            {
                MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
                cmd.Select("maps");
                MySqlReader r = new MySqlReader(cmd);
                [COLOR="Red"]while (r.Read())[/COLOR] <<<<<
                {
                    int MapID = r.ReadInt32("MapID");
                    string MapFile = r.ReadString("MapFile");
                    int NonPk = r.ReadInt32("NonPK");
                    int NonScroll = r.ReadInt32("NonScrollable");

                    if(NonPk == 1)
                        if (!World.NonPkMaps.Contains(MapID))
                            World.NonPkMaps.Add(MapID);
                    if(NonScroll == 1)
                        if (!World.NonScrollMaps.Contains(MapID))
                            World.NonScrollMaps.Add(MapID);

                    PICMaps map = new PICMaps("map\\pmaps\\" + MapFile, MapID);
                    PICMaps.PMaps.Add(MapID, map);
                    Program.WriteLine("[WorldServer] Loaded PMap " + MapID + "");
                }
            }
            catch (Exception EXC) { Program.WriteLine(EXC); }
        }
Database.cs line 964:
Code:
public static void LoadDynamicMaps()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("maps_dynamic");
            MySqlReader r = new MySqlReader(cmd);
            [COLOR="red"]while (r.Read())[/COLOR] <<<<<
            {
                int mapId = r.ReadInt32("MapID");
                string pmapfile = r.ReadString("MapFile");
                int type = r.ReadInt32("Type");

                DynaMap DM = new DynaMap();
                DM.MapID = mapId;
                DM.Type = type;
                PICMaps.DynamicMaps.Add(DM.MapID, DM);
                PICMaps map = new PICMaps("map\\pmaps\\" + pmapfile, mapId);
                PICMaps.PMaps.Add(mapId, map);

                Program.WriteLine("[WorldServer] Loaded Dynamic PMap " + mapId + "");
            }
        }
Initialize.cs line 28:
Code:
Database.LoadDynamicMaps();
World.cs line 151:
Code:
Initialize.LoadMaps();
If I could get any sort of help with these errors I would so much appreciate it.

Regards, killersub.
12/11/2011 19:09 BaussHacker#2
Exactly lines that's throwing the exception in the method?

Otherwise I can't exactly tell what's causing it, other than it's an object that you are trying to use, which has not yet been created.
12/11/2011 19:31 killersub#3
Quote:
Originally Posted by BaussHacker View Post
Exactly lines that's throwing the exception in the method?

Otherwise I can't exactly tell what's causing it, other than it's an object that you are trying to use, which has not yet been created.
the lines throwing the error are in "red" and pointed out in "<<<<<".

I have not touched the source If you're asking.
12/11/2011 19:48 Spirited#4
You probably don't have the pmaps extracted into the output bin
OR You probably don't have the table in your sql. That source can barely be used anymore.
12/11/2011 22:59 killersub#5
Quote:
Originally Posted by Fаng View Post
You probably don't have the pmaps extracted into the output bin
OR You probably don't have the table in your sql. That source can barely be used anymore.
what do you mean it can be barely used anymore?
12/11/2011 23:27 pro4never#6
Quote:
Originally Posted by killersub View Post
what do you mean it can be barely used anymore?
None of the required files are on any of the latest svn versions.
12/12/2011 02:40 { Angelius }#7
last time i looked Elite-CoEmu contained an empty load maps void, which means you are trying to create one.

so chances are..
1. wrong table name

2. a null MySqlDataAdapter

3. a Silent Exception

the tryFill void from the CoEmu MySqlHandler.dll
Quote:
private void TryFill(MySqlCommand command)
{
using (MySqlConnection mySqlConnection = new MySqlConnection(MySqlArgument.op_Implicit(Connecti ons.Argument)))
{
mySqlConnection.Open();
MySqlDataAdapter mySqlDataAdapter = null;
if (mySqlConnection.State == 1)
{
mySqlDataAdapter = new MySqlDataAdapter(command.Command, mySqlConnection);
this._dataset = new DataSet();
try
{
mySqlDataAdapter.Fill(this._dataset, "table");
}
catch (Exception)
{
}
this._row = 0;
}
}
}
i'm just guessing here so one of your options here is it to extract the MySqlHandler.dll,
and use the source code, you can then break point where ever you want and follow the error.


note: if the mySqlConnection.State does not = 1 then the mysqlreader._dataset will = null and when you call the Reader.Read void from out side the .dll you'll see the same Exception Message that you posted up there
12/13/2011 00:10 killersub#8
Quote:
Originally Posted by pro4never View Post
None of the required files are on any of the latest svn versions.
Quote:
Originally Posted by { Angelius } View Post
last time i looked Elite-CoEmu contained an empty load maps void, which means you are trying to create one.

so chances are..
1. wrong table name

2. a null MySqlDataAdapter

3. a Silent Exception

the tryFill void from the CoEmu MySqlHandler.dll


i'm just guessing here so one of your options here is it to extract the MySqlHandler.dll,
and use the source code, you can then break point where ever you want and follow the error.


note: if the mySqlConnection.State does not = 1 then the mysqlreader._dataset will = null and when you call the Reader.Read void from out side the .dll you'll see the same Exception Message that you posted up there
thank you both for your responses. that is all I needed to know for now (:.

#request close