---- DEBUG ASSERTION FAILED ---- FPE 3.5

Topics: Developer Forum, User Forum
Feb 23, 2014 at 10:45 AM
Edited Feb 23, 2014 at 11:17 AM
HI ALL! WTF?

---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ----

---- Assert Long Message ----
at ChainShape..ctor(Vertices vertices, Boolean createLoop)  
at FixtureFactory.AttachLoopShape(Vertices vertices, Body body, Object userData)  
at BodyFactory.CreateLoopShape(World world, Vertices vertices, Vector2 position, Object userData)  
at BodyFactory.CreateLoopShape(World world, Vertices vertices, Object userData)  
at Level1.LoadContent()  
at GamePage.InitializeGame()  
at GamePage.OnNavigatedTo(NavigationEventArgs e)  
at PhoneApplicationPage.InternalOnNavigatedTo(NavigationEventArgs e)  
at PhoneApplicationPage.Microsoft.Phone.Controls.IPhoneApplicationPage.InternalOnNavigatedToX(NavigationEventArgs e)  
at NavigationService.RaiseNavigated(Object content, Uri uri, NavigationMode mode, Boolean isNavigationInitiator, IPhoneApplicationPage existingContentPage, IPhoneApplicationPage newContentPage)  
at NavigationService.CompleteNavigation(DependencyObject content, NavigationMode mode)  
at NavigationService.ContentLoader_BeginLoad_Callback(IAsyncResult result)  
at PageResourceContentLoader.BeginLoad_OnUIThread(AsyncCallback userCallback, PageResourceContentLoaderAsyncResult result)  
at <>c__DisplayClass4.<BeginLoad>b__0(Object args)  
at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)  
at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)  
at RuntimeMethodInfo.UnsafeInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  
at Delegate.DynamicInvokeImpl(Object[] args)  
at DispatcherOperation.Invoke()  
at Dispatcher.Dispatch(DispatcherPriority priority)  
at Dispatcher.OnInvoke(Object context)  
at CallbackCookie.Invoke(Object[] args)  
at ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam* pParams, ScriptParam* pResult)  
An exception of type "System.String EntryPointNotFoundException" occurred in Unknown module. and was not handled to the border of managed and native code

everything works. But in Debug mode is double. ..


This debug only WP7

Silverlight AppDomainAssertAssertion Failed
at DefaultTraceListener.AssertFailure(String File, Int32 Line, String Expr)
at DefaultTraceListener.Fail(String message, String detailMessage)
at DefaultTraceListener.Fail(String message)
at TraceInternal.Fail(String message)
at TraceInternal.Assert(Boolean condition)
at Debug.Assert(Boolean condition)
at ChainShape..ctor(Vertices vertices, Boolean createLoop)
at FixtureFactory.AttachLoopShape(Vertices vertices, Body body, Object userData)
at BodyFactory.CreateLoopShape(World world, Vertices vertices, Vector2 position, Object userData)
at BodyFactory.CreateLoopShape(World world, Vertices vertices, Object userData)
at Level1.LoadContent()
at

Image
Feb 23, 2014 at 2:40 PM
Looks like a typo. In the parameter text it says "Must contain 2 or more vertices" but in the assert it's checking for 3 or more. Just change the 3 to a 2.
Feb 23, 2014 at 5:34 PM
Edited Feb 23, 2014 at 5:34 PM
HAL_9000 wrote:
Looks like a typo. In the parameter text it says "Must contain 2 or more vertices" but in the assert it's checking for 3 or more. Just change the 3 to a 2.
It does not work.


After changing the error: __PolygonShape.cs
Debug.Assert (Vertices. Count > = 3);

Changed to this:
Debug.Assert (Vertices. Count > = 2);

After that this error:
//The area is too small for the engine to handle.
        Debug.Assert(area > Settings.Epsilon);
Not enough points for the polygon and it is true, should be > = 3
Feb 23, 2014 at 5:55 PM
It's ChainShape.cs like in the image you posted you want to change rather than PolygonShape.cs.

Polygons need more than 2 Vectors in a vertice or it can't have a shape but chain shapes are just edges as far as I know.
Feb 23, 2014 at 5:58 PM
HAL_9000 wrote:
It's ChainShape.cs like in the image you posted you want to change rather than PolygonShape.cs.

Polygons need more than 2 Vectors in a vertice or it can't have a shape but chain shapes are just edges as far as I know.
After I change ChainShape.cs, error in PolygonShape.cs
Feb 23, 2014 at 6:45 PM
Chain shapes and polygon shapes are two different things so it sounds like you're trying to use the same vertices to make a polygon and a chain shape.

Are you casting the Vertices of the body at some point into a PolygonShape? Cause that'd break it.

Can you post the code?
Feb 24, 2014 at 9:02 AM
Edited Feb 26, 2014 at 8:07 PM
HAL_9000 wrote:
Chain shapes and polygon shapes are two different things so it sounds like you're trying to use the same vertices to make a polygon and a chain shape.

Are you casting the Vertices of the body at some point into a PolygonShape? Cause that'd break it.

Can you post the code?
ONE
This is a separate image. 1..2..3
for each of them, one algorithm.
 data = new uint[(plankaPolyTexture.Width) * (plankaPolyTexture.Height)];
            plankaPolyTexture.GetData(data);
            Vertices verts = PolygonTools.CreatePolygon(data, (plankaPolyTexture.Width), false);         
            Vector2 scale = new Vector2(CoordinateHelper.pixelToUnit * scale_, CoordinateHelper.pixelToUnit * scale_);
            verts.Scale(ref scale);        
            polygonOrigin = verts.GetCentroid();          
            Vector2 vertsTranslate = -polygonOrigin;
            verts.Translate(ref vertsTranslate);
            list = FarseerPhysics.Common.Decomposition.Triangulate.ConvexPartition(verts,TriangulationAlgorithm.Bayazit,false);           
            bodyPlanka = BodyFactory.CreateCompoundPolygon(world, list, density,bodyPlanka);

            bodyPlanka.BodyType = BodyType.Static;
            bodyPlanka.Restitution = 0.1f;
TWO
 uint[] data = new uint[blockTexture.Width * blockTexture.Height];
            blockTexture.GetData(data);
            Vertices textureVertices = PolygonTools.CreatePolygon(data, blockTexture.Width, false);
            Vector2 centroid = -textureVertices.GetCentroid();
            textureVertices.Translate(ref centroid);
            _origin = -centroid;
            textureVertices = SimplifyTools.ReduceByDistance(textureVertices, 4f);
            list = Triangulate.ConvexPartition(textureVertices, TriangulationAlgorithm.Bayazit);
            Vector2 vertScale = new Vector2(CoordinateHelper.pixelToUnit * _scale, CoordinateHelper.pixelToUnit * _scale);
            foreach (Vertices vertices in list)
            {
                vertices.Scale(ref vertScale);
            }
            _compound = BodyFactory.CreateCompoundPolygon(world, list, 1, BodyType.Static);
            _compound.BodyType = BodyType.Static;
Feb 24, 2014 at 10:23 AM
That compiles and runs fine on my system. Where do you get the error? At CreateCompoundPolygon()?
Feb 24, 2014 at 10:49 AM
HAL_9000 wrote:
That compiles and runs fine on my system. Where do you get the error? At CreateCompoundPolygon()?
I don't know an error getting the ChainShape.cs
Feb 24, 2014 at 10:58 AM
---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ----

---- Assert Long Message ----
at ChainShape..ctor(Vertices vertices, Boolean createLoop)  
at FixtureFactory.AttachLoopShape(Vertices vertices, Body body, Object userData)  
at BodyFactory.CreateLoopShape(World world, Vertices vertices, Vector2 position, Object userData)  
at BodyFactory.CreateLoopShape(World world, Vertices vertices, Object userData)  
at Level1.LoadContent()  
at GamePage.InitializeGame()  
at GamePage.OnNavigatedTo(NavigationEventArgs e)  
at PhoneApplicationPage.InternalOnNavigatedTo(NavigationEventArgs e)  
at PhoneApplicationPage.Microsoft.Phone.Controls.IPhoneApplicationPage.InternalOnNavigatedToX(NavigationEventArgs e)  
at NavigationService.RaiseNavigated(Object content, Uri uri, NavigationMode mode, Boolean isNavigationInitiator, IPhoneApplicationPage existingContentPage, IPhoneApplicationPage newContentPage)  
at NavigationService.CompleteNavigation(DependencyObject content, NavigationMode mode)  
at NavigationService.ContentLoader_BeginLoad_Callback(IAsyncResult result)  
at PageResourceContentLoader.BeginLoad_OnUIThread(AsyncCallback userCallback, PageResourceContentLoaderAsyncResult result)  
at <>c__DisplayClass4.<BeginLoad>b__0(Object args)  
at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)  
at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)  
at RuntimeMethodInfo.UnsafeInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  
at Delegate.DynamicInvokeImpl(Object[] args)  
at DispatcherOperation.Invoke()  
at Dispatcher.Dispatch(DispatcherPriority priority)  
at Dispatcher.OnInvoke(Object context)  
at CallbackCookie.Invoke(Object[] args)  
at ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam* pParams, ScriptParam* pResult)  
Исключение типа "System.EntryPointNotFoundException" возникло в Неизвестный модуль. и не было обработано до границы управляемого и машинного кода
---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ----

---- Assert Long Message ----
at ChainShape..ctor(Vertices vertices, Boolean createLoop)  
at FixtureFactory.AttachLoopShape(Vertices vertices, Body body, Object userData)  
at BodyFactory.CreateLoopShape(World world, Vertices vertices, Vector2 position, Object userData)  
at BodyFactory.CreateLoopShape(World world, Vertices vertices, Object userData)  
at Level1.LoadContent()  
at GamePage.InitializeGame()  
at GamePage.OnNavigatedTo(NavigationEventArgs e)  
at PhoneApplicationPage.InternalOnNavigatedTo(NavigationEventArgs e)  
at PhoneApplicationPage.Microsoft.Phone.Controls.IPhoneApplicationPage.InternalOnNavigatedToX(NavigationEventArgs e)  
at NavigationService.RaiseNavigated(Object content, Uri uri, NavigationMode mode, Boolean isNavigationInitiator, IPhoneApplicationPage existingContentPage, IPhoneApplicationPage newContentPage)  
at NavigationService.CompleteNavigation(DependencyObject content, NavigationMode mode)  
at NavigationService.ContentLoader_BeginLoad_Callback(IAsyncResult result)  
at PageResourceContentLoader.BeginLoad_OnUIThread(AsyncCallback userCallback, PageResourceContentLoaderAsyncResult result)  
at <>c__DisplayClass4.<BeginLoad>b__0(Object args)  
at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)  
at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)  
at RuntimeMethodInfo.UnsafeInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  
at Delegate.DynamicInvokeImpl(Object[] args)  
at DispatcherOperation.Invoke()  
at Dispatcher.Dispatch(DispatcherPriority priority)  
at Dispatcher.OnInvoke(Object context)  
at CallbackCookie.Invoke(Object[] args)  
at ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam* pParams, ScriptParam* pResult)  
Поток 0xdf8 завершился с кодом 259 (0x103).
Исключение типа "System.EntryPointNotFoundException" возникло в Неизвестный модуль. и не было обработано до границы управляемого и машинного кода
Поток 0xf98 завершился с кодом 259 (0x103).
---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ----

---- Assert Long Message ----
at PolygonShape.ComputeProperties()  
at PolygonShape.set_Vertices(Vertices value)  
at PolygonShape..ctor(Vertices vertices, Single density)  
at FixtureFactory.AttachCompoundPolygon(List`1 list, Single density, Body body, Object userData)  
at BodyFactory.CreateCompoundPolygon(World world, List`1 list, Single density, Vector2 position, Object userData)  
at BodyFactory.CreateCompoundPolygon(World world, List`1 list, Single density, Object userData)  
at Planka..ctor(Boolean GreenSwitch, Boolean RedSwitch, Boolean BlueSwitch, World world, Texture2D PlankaTexture, Vector2 PlankaPosition, Texture2D PlankaGlueGreenTexture, Vector2 PlankaGlueGreenPosition, Texture2D PlankaGlueRedTexture, Vector2 PlankaGlueRedPosition, Texture2D PlankaGlueBlueTexture, Vector2 PlankaGlueBluePosition, Single density, Single scale_, Texture2D PlankaPolyTexture, Vector2 polygonOrigin, Texture2D flashRedTexture, Texture2D flashGreenTexture, Texture2D flashBlueTexture, Texture2D flashBadRedTexture, Texture2D flashBadGreenTexture, Texture2D flashBadBlueTexture)  
at Level1.PlankaLoad()  
at Level1.LoadContent()  
at GamePage.InitializeGame()  
at GamePage.OnNavigatedTo(NavigationEventArgs e)  
at PhoneApplicationPage.InternalOnNavigatedTo(NavigationEventArgs e)  
at PhoneApplicationPage.Microsoft.Phone.Controls.IPhoneApplicationPage.InternalOnNavigatedToX(NavigationEventArgs e)  
at NavigationService.RaiseNavigated(Object content, Uri uri, NavigationMode mode, Boolean isNavigationInitiator, IPhoneApplicationPage existingContentPage, IPhoneApplicationPage newContentPage)  
at NavigationService.CompleteNavigation(DependencyObject content, NavigationMode mode)  
at NavigationService.ContentLoader_BeginLoad_Callback(IAsyncResult result)  
at PageResourceContentLoader.BeginLoad_OnUIThread(AsyncCallback userCallback, PageResourceContentLoaderAsyncResult result)  
at <>c__DisplayClass4.<BeginLoad>b__0(Object args)  
at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)  
at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)  
at RuntimeMethodInfo.UnsafeInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  
at Delegate.DynamicInvokeImpl(Object[] args)  
at DispatcherOperation.Invoke()  
at Dispatcher.Dispatch(DispatcherPriority priority)  
at Dispatcher.OnInvoke(Object context)  
at CallbackCookie.Invoke(Object[] args)  
at ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam* pParams, ScriptParam* pResult)  
Исключение типа "System.EntryPointNotFoundException" возникло в Неизвестный модуль. и не было обработано до границы управляемого и машинного кода
Feb 24, 2014 at 10:59 AM
Исключение типа "System.EntryPointNotFoundException" возникло в Неизвестный модуль. и не было обработано до границы управляемого и машинного кода
---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ----

---- Assert Long Message ----
at PolygonShape.ComputeProperties()  
at PolygonShape.set_Vertices(Vertices value)  
at PolygonShape..ctor(Vertices vertices, Single density)  
at FixtureFactory.AttachCompoundPolygon(List`1 list, Single density, Body body, Object userData)  
at BodyFactory.CreateCompoundPolygon(World world, List`1 list, Single density, Vector2 position, Object userData)  
at BodyFactory.CreateCompoundPolygon(World world, List`1 list, Single density, Object userData)  
at Planka..ctor(Boolean GreenSwitch, Boolean RedSwitch, Boolean BlueSwitch, World world, Texture2D PlankaTexture, Vector2 PlankaPosition, Texture2D PlankaGlueGreenTexture, Vector2 PlankaGlueGreenPosition, Texture2D PlankaGlueRedTexture, Vector2 PlankaGlueRedPosition, Texture2D PlankaGlueBlueTexture, Vector2 PlankaGlueBluePosition, Single density, Single scale_, Texture2D PlankaPolyTexture, Vector2 polygonOrigin, Texture2D flashRedTexture, Texture2D flashGreenTexture, Texture2D flashBlueTexture, Texture2D flashBadRedTexture, Texture2D flashBadGreenTexture, Texture2D flashBadBlueTexture)  
at Level1.PlankaLoad()  
at Level1.LoadContent()  
at GamePage.InitializeGame()  
at GamePage.OnNavigatedTo(NavigationEventArgs e)  
at PhoneApplicationPage.InternalOnNavigatedTo(NavigationEventArgs e)  
at PhoneApplicationPage.Microsoft.Phone.Controls.IPhoneApplicationPage.InternalOnNavigatedToX(NavigationEventArgs e)  
at NavigationService.RaiseNavigated(Object content, Uri uri, NavigationMode mode, Boolean isNavigationInitiator, IPhoneApplicationPage existingContentPage, IPhoneApplicationPage newContentPage)  
at NavigationService.CompleteNavigation(DependencyObject content, NavigationMode mode)  
at NavigationService.ContentLoader_BeginLoad_Callback(IAsyncResult result)  
at PageResourceContentLoader.BeginLoad_OnUIThread(AsyncCallback userCallback, PageResourceContentLoaderAsyncResult result)  
at <>c__DisplayClass4.<BeginLoad>b__0(Object args)  
at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)  
at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)  
at RuntimeMethodInfo.UnsafeInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  
at Delegate.DynamicInvokeImpl(Object[] args)  
at DispatcherOperation.Invoke()  
at Dispatcher.Dispatch(DispatcherPriority priority)  
at Dispatcher.OnInvoke(Object context)  
at CallbackCookie.Invo
Feb 24, 2014 at 11:01 AM
This is after an upgrade 3.2 -> 3.5
Feb 24, 2014 at 11:17 AM
Edited Feb 24, 2014 at 11:17 AM
HAL_9000 wrote:
That compiles and runs fine on my system. Where do you get the error? At CreateCompoundPolygon()?
When I delete this code, so there is no error.
 world = new World(new Vector2(0, 7));

            
            float height = (viewport_.Height / CoordinateHelper.unitToPixel);
            float width = (viewport_.Width / CoordinateHelper.unitToPixel);

            Vertices borders = new Vertices(1);
            borders.Add(new Vector2(0, 0));
            borders.Add(new Vector2(0, height));
            borderBody = BodyFactory.CreateLoopShape(world, borders);

            Vertices borders2 = new Vertices(1);
            borders2.Add(new Vector2(width, 0));
            borders2.Add(new Vector2(width, height));
            borderBody2 = BodyFactory.CreateLoopShape(world, borders2);    
Feb 24, 2014 at 11:26 AM
Ah now that makes sense!

You're trying to make a loop shape with only 2 Vectors. As it's just a line it has an area of 0.

Try using this instead:

               float height = (viewport_.Height / CoordinateHelper.unitToPixel);
            float width = (viewport_.Width / CoordinateHelper.unitToPixel);
borderBody = BodyFactory.CreateEdge(world, new Vector2(0, 0), new Vector2(0, height));
            borderBody2 = BodyFactory.CreateEdge(world, new Vector2(width, 0), new Vector2(width, height));
Feb 24, 2014 at 11:45 AM
HAL_9000 wrote:
Ah now that makes sense!

You're trying to make a loop shape with only 2 Vectors. As it's just a line it has an area of 0.

Try using this instead:

               float height = (viewport_.Height / CoordinateHelper.unitToPixel);
            float width = (viewport_.Width / CoordinateHelper.unitToPixel);
borderBody = BodyFactory.CreateEdge(world, new Vector2(0, 0), new Vector2(0, height));
            borderBody2 = BodyFactory.CreateEdge(world, new Vector2(width, 0), new Vector2(width, height));
It did not help.

I delete only

//world = new World (new Vector2 (0, 7));
and
//world.Step (totalSeconds);

and there is no such errors.
Feb 24, 2014 at 11:58 AM
Really? Wow, that's weird.

You won't be getting the error if you delete world.step() as the physics engine does it's updates there.

Can you zip and upload the whole program? Or a small example program that reproduces the error? I'd like to look at the code as it runs.
Feb 24, 2014 at 12:16 PM
HAL_9000 wrote:
Really? Wow, that's weird.

You won't be getting the error if you delete world.step() as the physics engine does it's updates there.

Can you zip and upload the whole program? Or a small example program that reproduces the error? I'd like to look at the code as it runs.
These are classes where you use FPE 3.5
CODE.rar
Feb 24, 2014 at 12:30 PM
Edited Feb 24, 2014 at 12:31 PM
**HAL_9000 **

Thank you for trying to help!
Feb 24, 2014 at 12:42 PM
No problem, I'm currently killing time waiting for Xamarin to download and install and on my internet it takes a while lol.

I can't compile that download to see where the error is as the rest of the solution is missing but if you run it and get the error double click on the "at Level1.PlankaLoad()" in the call stack and it will tell you which texture it's trying to load. The code looks fine so it may be a problem with the texture itself.
Feb 27, 2014 at 11:35 AM
HAL_9000 wrote:
No problem, I'm currently killing time waiting for Xamarin to download and install and on my internet it takes a while lol.

I can't compile that download to see where the error is as the rest of the solution is missing but if you run it and get the error double click on the "at Level1.PlankaLoad()" in the call stack and it will tell you which texture it's trying to load. The code looks fine so it may be a problem with the texture itself.
  data = new uint[(plankaPolyTexture.Width) * (plankaPolyTexture.Height)];
            plankaPolyTexture.GetData(data);
            Vertices verts = PolygonTools.CreatePolygon(data, (plankaPolyTexture.Width), false);         
            Vector2 scale = new Vector2(CoordinateHelper.pixelToUnit * scale_, CoordinateHelper.pixelToUnit * scale_);
            verts.Scale(ref scale);        
            polygonOrigin = verts.GetCentroid();          
            Vector2 vertsTranslate = -polygonOrigin;
            verts.Translate(ref vertsTranslate);
            list = FarseerPhysics.Common.Decomposition.Triangulate.ConvexPartition(verts,TriangulationAlgorithm.Bayazit,false);           
            bodyPlanka = BodyFactory.CreateCompoundPolygon(world, list, density,bodyPlanka);
I have solved the problem. Error on this line, at the end I put a value of "true"
 list = FarseerPhysics.Common.Decomposition.Triangulate.ConvexPartition(verts,TriangulationAlgorithm.Bayazit,true);
Marked as answer by AlexanderSG on 3/1/2014 at 7:48 AM