Silverlight AppDomainAssertAssertion Failed..

Topics: Developer Forum
Feb 21, 2011 at 12:32 PM

Hi,

I am working on a Windows Phone 7 game which uses the Physics Helper library for basic physics and collisions in my game.

I am raising this thread in the farseer forum because I think the exception that I am getting is related to Farseer, which is what Physics Helper uses.

The game consists of a couple of marbles on the screen. Each marble is basically a Rectangle with its Fill property set to an ImageBrush, and I've set the BoundaryObject to an ellipse for proper collisions.

The game has a new button, and everytime the user presses the new button, existing marbles on the screen are cleared, the corresponding physics objects are deleted, and a random number of marbles are added back. The number of marbles varies between 4-8.

Now, the game works nicely most of the times but if I keep pressing the new button continuously 10-15 times, the whole physics system breaks down. And sometimes I get the below exception,

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 Island.Add(Joint joint)
   at World.Solve(TimeStep& step)
   at World.Step(Single dt)
   at PhysicsControllerMain.CompositionTarget_Rendering(Object sender, EventArgs e)
   at CompositionTarget.OnRendering(Object sender, RenderingEventArgs e)

This exception doesn't happen always, but with or without it, the game gets screwed. I can't move the marbles anymore, the objects become unresponsive and they keep kinda shivering in their place.

The new button is actually an Image and I am handling the Manipulation_Started and Manipulation_Completed events on it. I make sure that if a current New button click is in progress, and the next manipulation completed event happens before the processing of previous click is complete, I just return from the function, without doing anything.

Has anyone seen this error or behaviour before?

Unfortunately, I cannot share the code here. Sorry.

Thanks for your help.

 

Prabhu
www.techtwaddle.net

Mar 30, 2011 at 8:59 PM

I'm running into the same problem as here. I have a game that seems to work most of the time but, seemingly randomly, everything freezes and becomes unresponsive. A look at the stacktrace and it's pretty much the same as PrabhuK's but I have this line at the end:

  JoltHelper.RaiseEvent(IntPtr tarStep into: Stepping over method without symbols 'FarseerPhysics.Dynamics.Contacts.ContactSolver.InitializeVelocityConstraints'

Any ideas what this could be as it seems impossible to reproduce (just pops up randomly). 

Thanks!

Mar 30, 2011 at 11:55 PM
Edited Mar 31, 2011 at 12:25 AM

I think I've managed to narrow the problem down. It doesn't seem to occur (yet?) when I remove this line:

 player.Position = resetPlayer;

This forces the body to go back to its original position. Could it be that forcing the body to a certain position is playing with other properties such as the velocity constraints? Is there a 'safer' way of resetting a body's position (for example, when you reset a level, the player should go back to the starting position).

EDIT:  Nope, it's started again. Strange error...

Jun 15, 2012 at 9:35 AM
Edited Jun 15, 2012 at 9:39 AM

I have same problem and i found solution.

At first we have error:

at Debug.Assert(Boolean condition)
at PolygonShape.ComputeProperties()
at PolygonShape.Set(Vertices vertices)
at PolygonShape..ctor(Vertices vertices, Single density)
at FixtureFactory.CreateEllipse(Single xRadius, Single yRadius, Int32 edges, Single density, Body body, Object userData)

I looking assembly FarseerPhysicsXNA.dll from Reflector and found this lines of code

public void Set(Vertices vertices)
{
    ...
    Debug.Assert((vertices.Count >= 2) && (vertices.Count <= Settings.MaxPolygonVertices));
    ...
}

Where Settings.MaxPolygonVertices equal 8 and vertices.Count is value of parameter edges in method

FixtureFactory.CreateEllipse(Single xRadius, Single yRadius, Int32 edges, Single density, Body body, Object userData)

I hope it help you