Argalep

Member
Code:
Exception:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at Server.Map.ClientEnumerator.MoveNext() in ..\Server\Map.cs:line 1399
   at Server.Mobile.SetLocation(Point3D newLocation, Boolean isTeleport) in ..\Server\Mobile.cs:line 10054
   at Server.Mobiles.BaseCreature.SetLocation(Point3D newLocation, Boolean isTeleport)
   at Server.Mobile.Move(Direction d) in ..\Server\Mobile.cs:line 3364
   at Server.Mobiles.BaseAI.DoMoveImpl(Direction d)
   at Server.Mobiles.BaseAI.DoMove(Direction d, Boolean badStateOk)
   at Server.Mobiles.BaseAI.WalkRandom(Int32 iChanceToNotMove, Int32 iChanceToDir, Int32 iSteps)
   at Server.Mobiles.BaseAI.WalkRandomInHome(Int32 iChanceToNotMove, Int32 iChanceToDir, Int32 iSteps)
   at Server.Mobiles.BaseAI.DoActionWander()
   at Server.Mobiles.MeleeAI.DoActionWander()
   at Server.Mobiles.BaseAI.AITimer.OnTick()
   at Server.Timer.Slice() in  ..\Server\Timer.cs:line 387
   at Server.Core.Main(String[] args) in ..\Server\Main.cs:line 622[\code]

Map.cs line 1399

Mobile m = m_CurrentList[m_CurrentIndex].Mobile;


Code:
public bool MoveNext()
			{
				while (true)
				{
					++m_CurrentIndex;

					if (m_CurrentIndex == m_CurrentList.Count)
					{
						++m_ySector;

						if (m_ySector > m_ySectorEnd)
						{
							m_ySector = m_ySectorStart;
							++m_xSector;

							if (m_xSector > m_xSectorEnd)
							{
								m_CurrentIndex = -1;
								return false;
							}
						}

						m_CurrentIndex = -1;
						m_CurrentList = m_Map.InternalGetSector(m_xSector, m_ySector).Clients;
					}
					else
					{
						Mobile m = m_CurrentList[m_CurrentIndex].Mobile; // line 1399

						if (m != null && !m.Deleted && m_Bounds.Contains(m.Location))
						{
							return true;
						}
					}
				}
			}
 
Last edited:
Could you please describe what happened for your shard to crash?

Have you made any modifications to your core?

Here is my private class EntityEnumerator : IPooledEnumerator<IEntity> method is yours the same?

Code:
private class EntityEnumerator : IPooledEnumerator<IEntity>
		{
			private Map m_Map;
			private Rectangle2D m_Bounds;

			private int m_xSector, m_ySector;
			private int m_xSectorStart, m_ySectorStart;
			private int m_xSectorEnd, m_ySectorEnd;
			private int m_Stage;
			private IList m_CurrentList;
			private int m_CurrentIndex;

			private static readonly Queue<EntityEnumerator> m_InstancePool = new Queue<EntityEnumerator>();

			public static EntityEnumerator Instantiate(Map map, Rectangle2D bounds)
			{
				EntityEnumerator e = null;

				lock (m_InstancePool)
				{
					if (m_InstancePool.Count > 0)
					{
						e = m_InstancePool.Dequeue();

						e.m_Map = map;
						e.m_Bounds = bounds;
					}
				}

				if (e == null)
				{
					e = new EntityEnumerator(map, bounds);
				}

				e.Reset();

				return e;
			}

			public void Free()
			{
				if (m_Map == null)
				{
					return;
				}

				m_Map = null;

				lock (m_InstancePool)
				{
					if (m_InstancePool.Count < 200) // Arbitrary
					{
						m_InstancePool.Enqueue(this);
					}
				}
			}

			private EntityEnumerator(Map map, Rectangle2D bounds)
			{
				m_Map = map;
				m_Bounds = bounds;
			}

			public IEntity Current { get { return (IEntity)m_CurrentList[m_CurrentIndex]; } }

			object IEnumerator.Current { get { return m_CurrentList[m_CurrentIndex]; } }

			void IDisposable.Dispose()
			{ }

			public bool MoveNext()
			{
				while (true)
				{
					++m_CurrentIndex;

					if (m_CurrentIndex == m_CurrentList.Count)
					{
						++m_ySector;

						if (m_ySector > m_ySectorEnd)
						{
							m_ySector = m_ySectorStart;
							++m_xSector;

							if (m_xSector > m_xSectorEnd)
							{
								if (m_Stage > 0)
								{
									m_CurrentIndex = -1;
									return false;
								}
								++m_Stage;
								m_xSector = m_xSectorStart >>= SectorShift;
								m_ySector = m_ySectorStart >>= SectorShift;
							}
						}

						m_CurrentIndex = -1;

						if (m_Stage == 0)
						{
							m_CurrentList = m_Map.InternalGetSector(m_xSector, m_ySector).Items;
						}
						else
						{
							m_CurrentList = m_Map.InternalGetSector(m_xSector, m_ySector).Mobiles;
						}
					}
					else
					{
						IEntity e = (IEntity)m_CurrentList[m_CurrentIndex];

						if (e is Item)
						{
							Item item = (Item)e;

							if (!item.Deleted && item.Parent == null && m_Bounds.Contains(e.Location))
							{
								return true;
							}
						}
						else if (e is Mobile)
						{
							Mobile m = (Mobile)e;
							if (!m.Deleted && m_Bounds.Contains(e.Location))
							{
								return true;
							}
						}
					}
				}
			}
 
Please argalep don't post every problem with your server in bug reports, add in either script support or windows support :) IF it turns out to be an actual bug then we can move it.
 
I'm sorry milva,

Omni crash line is 1399

Code:
public bool MoveNext()
			{
				while (true)
				{
					++m_CurrentIndex;

					if (m_CurrentIndex == m_CurrentList.Count)
					{
						++m_ySector;

						if (m_ySector > m_ySectorEnd)
						{
							m_ySector = m_ySectorStart;
							++m_xSector;

							if (m_xSector > m_xSectorEnd)
							{
								m_CurrentIndex = -1;
								return false;
							}
						}

						m_CurrentIndex = -1;
						m_CurrentList = m_Map.InternalGetSector(m_xSector, m_ySector).Clients;
					}
					else
					{
						Mobile m = m_CurrentList[m_CurrentIndex].Mobile; // line 1399

						if (m != null && !m.Deleted && m_Bounds.Contains(m.Location))
						{
							return true;
						}
					}
				}
			}

Mobile m = m_CurrentList[m_CurrentIndex].Mobile;
 
What version are you using? Servuo? Runuo Rc2? Rc1? Svn?
How is the crash made?
Have you made core changes?

Your mobile.cs is quite different from mine and im running all the latest content on servuo..
 
Hey !

I used to have the same crash ...

For those encountering the same bug, here's my fix :

Code:
	public bool MoveNext()
			{
				while (true)
				{
					++m_CurrentIndex;
 
					if (m_CurrentIndex == m_CurrentList.Count)
					{
						++m_ySector;
 
						if (m_ySector > m_ySectorEnd)
						{
							m_ySector = m_ySectorStart;
							++m_xSector;
 
							if (m_xSector > m_xSectorEnd)
							{
								m_CurrentIndex = -1;
								return false;
							}
						}
 
						m_CurrentIndex = -1;
						m_CurrentList = m_Map.InternalGetSector(m_xSector, m_ySector).Clients;
					}
					else
					{		
						if (m_CurrentList.Count == 0)
							return false;
 
						if (m_CurrentIndex > m_CurrentList.Count)
							return false;
					
						Mobile m = m_CurrentList[m_CurrentIndex].Mobile;
 
						if (m != null && !m.Deleted && m_Bounds.Contains(m.Location))
						{
							return true;
						}
					}
				}
			}

It might come from a mod ... not sure it's ServUO related ;)

Cheers,

-Rek-
 
very clever solution. But if I find that which stems from the creature, I'm very relaxed. Thanks you..
 
argalep did you get your problem fixed? If so you might post how you stopped the crash in case some one else has this problem :) Do you believe this was a bug with servuo?
 
I'm not sure it's the right fix ...

The line 1399 in your file is before the line where you put your fix.

But if you say it's ok, good for you ;)
 

Active Shards

Donations

Total amount
$50.00
Goal
$1,000.00
Back