Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Randomly thrown OverflowException in SharpDX.MathUtil.NearEqual #180

Closed
AliveDevil opened this issue Oct 17, 2013 · 1 comment
Closed

Randomly thrown OverflowException in SharpDX.MathUtil.NearEqual #180

AliveDevil opened this issue Oct 17, 2013 · 1 comment
Labels

Comments

@AliveDevil
Copy link

Hey, I just found a bug in the SharpDX Api.
Exception:

German: Das Negieren des minimalen Wertes einer Ergänzungszahl ist unzulässig.
English: Negating the minimum value of a twos complement number is invalid.

StackTrace:

   bei System.Math.Abs(Int32 value)
   bei SharpDX.MathUtil.NearEqual(Single a, Single b)
   bei SharpDX.Vector3.Equals(Vector3 other)
   bei System.Collections.Generic.GenericEqualityComparer`1.Equals(T x, T y)
   bei System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
   bei System.Collections.Generic.Dictionary`2.ContainsKey(TKey key)
   bei Adventure.World.Manager.WorldManager.Update(GameTime gameTime)
   bei Adventure.Player.Screens.PlayerScreen.Update(GameTime gameTime)
   bei FiNgine.Manager.UIManager.Update(GameTime gameTime) in UIManager.cs:Zeile 122.
   bei FiNgine.Core.Game.Update(GameTime gameTime) in Game.cs:Zeile 129
   bei SharpDX.Toolkit.Game.Tick()
   bei SharpDX.Toolkit.GameWindowDesktop.RenderLoopCallback()
   bei SharpDX.Windows.RenderLoop.ProxyNativeWindow.Run(RenderCallback renderCallback)
   bei SharpDX.Windows.RenderLoop.Run(Control form, RenderCallback renderCallback)
   bei SharpDX.Toolkit.GameWindowDesktop.Run()
   bei SharpDX.Toolkit.GamePlatform.Run(GameContext gameContext)
   bei SharpDX.Toolkit.Game.Run(GameContext gameContext)
   bei FiNgine.Core.Program.Main(String[] args) in Program.cs:Zeile 24.
   bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   bei System.Threading.ThreadHelper.ThreadStart()

(bei = at, Zeile = Line)
Content of dictionary:

-       chunks  Count = 34  System.Collections.Generic.Dictionary<SharpDX.Vector3,Chunk>
+       [0] {[X:0 Y:0 Z:0, Chunk]}
+       [1] {[X:-1 Y:0 Z:-1, Chunk]}
+       [2] {[X:-1 Y:0 Z:0, Chunk]}
+       [3] {[X:-1 Y:0 Z:1, Chunk]}
+       [4] {[X:0 Y:0 Z:-1, Chunk]}
+       [5] {[X:0 Y:0 Z:1, Chunk]}
+       [6] {[X:1 Y:0 Z:-1, Chunk]}
+       [7] {[X:1 Y:0 Z:0, Chunk]}
+       [8] {[X:1 Y:0 Z:1, Chunk]}
+       [9] {[X:-2 Y:0 Z:-1, Chunk]}
+       [10]    {[X:-2 Y:0 Z:0, Chunk]}
+       [11]    {[X:-2 Y:0 Z:1, Chunk]}
+       [12]    {[X:-2 Y:0 Z:2, Chunk]}
+       [13]    {[X:-1 Y:0 Z:2, Chunk]}
+       [14]    {[X:0 Y:0 Z:2, Chunk]}
+       [15]    {[X:-3 Y:0 Z:0, Chunk]}
+       [16]    {[X:-3 Y:0 Z:1, Chunk]}
+       [17]    {[X:-3 Y:0 Z:2, Chunk]}
+       [18]    {[X:-3 Y:0 Z:3, Chunk]}
+       [19]    {[X:-2 Y:0 Z:3, Chunk]}
+       [20]    {[X:-1 Y:0 Z:3, Chunk]}
+       [21]    {[X:-4 Y:0 Z:1, Chunk]}
+       [22]    {[X:-4 Y:0 Z:2, Chunk]}
+       [23]    {[X:-4 Y:0 Z:3, Chunk]}
+       [24]    {[X:-4 Y:0 Z:4, Chunk]}
+       [25]    {[X:-3 Y:0 Z:4, Chunk]}
+       [26]    {[X:-2 Y:0 Z:4, Chunk]}
+       [27]    {[X:-1 Y:0 Z:4, Chunk]}
+       [28]    {[X:0 Y:0 Z:3, Chunk]}
+       [29]    {[X:0 Y:0 Z:4, Chunk]}
+       [30]    {[X:-2 Y:0 Z:5, Chunk]}
+       [31]    {[X:-1 Y:0 Z:5, Chunk]}
+       [33]    {[X:1 Y:0 Z:3, Chunk]}
+       [32]    {[X:0 Y:0 Z:5, Chunk]}

Crashing line is:

Vector3 vec = {X:1 Y:0 Z:4}
if (!(chunks.ContainsKey(vec)))
@ArtiomCiumac
Copy link
Contributor

This is now fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants