ASSERT error when using Box2Dx in CSharp

Hello,

I am a newbie at using Box2D, and I am currently working on a project with Visual CSharp . I would like to use the C# port of Box2D, and I have been trying to make it in the following way :

- Create a new winform program
- Add a reference to the Box2DX.dll file
- Add the following code, adaptated from the samples in C++ I found in the Box2D website :

Box2DX.Collision.AABB worldAABB = new Box2DX.Collision.AABB();
worldAABB.LowerBound.Set(100.0f, 100.0f);
worldAABB.UpperBound.Set(100.0f, 100.0f);

Box2DX.Common.Vec2 gravity= new Box2DX.Common.Vec2(0.0f, -10.0f);
bool doSleep = true;
Box2DX.Dynamics.World world = new Box2DX.Dynamics.World(worldAABB, gravity, doSleep);

Box2DX.Dynamics.BodyDef groundBodyDef = new Box2DX.Dynamics.BodyDef();
groundBodyDef.Position.Set(0.0f, -10.0f);

Box2DX.Dynamics.Body groundBody =world.CreateBody(groundBodyDef);
groundBody.ToString();

Box2DX.Collision.PolygonDef groundShapeDef = new Box2DX.Collision.PolygonDef();
groundShapeDef.SetAsBox(50.0f, 10.0f);

Box2DX.Collision.Shape s = groundBody.CreateShape((Box2DX.Collision.ShapeDef)groundShapeDef);

Everything works well until the last line. When the last line is executed, I get an ASSERT(boolean condition) message from
Box2DXDebug. Unfortunately, I was unable to understand where the problem comes from. Can somedy help me ?

Another point is about finding the source code of Box2DX. Is it available somewhere, and can I download it ?

Thank you in advance for any help or advice.
FYI, in the error message I get, the message indicates that error commes form :

Box2DXDebug.cs (line 34)
Shape.CreateProxy(...) in Shape.cs (line 344)
Body.CreateShape(...) in Body.cs (line 295)

Also note that I get the same error message if I write the last line of my code in the following way :

groundBody.CreateShape((Box2DX.Collision.ShapeDef)groundShapeDef);

Hope this helps.
Firstly, I would use the Box2D.XNA version of the engine. It can be found here: http://box2dxna.codeplex.com/ It is synced with the latest revision of the engine. Now in order to use that version of the engine without XNA some mods have to be made. You will need to download the source code to the Farseer Physics engine and add Vector2.cs, Vector3.cs, Matrix.cs, Math.cs, FixedArray.cs, MathHelper.cs. You will also have to modify the DrawDebugData() function to not do anything or draw using System.Forms.Drawing instead of XNA.

Or you can download the latest source code for the Farseer Physics engine here: http://farseerphysics.codeplex.com/ and use the project from Branches/FP3.0/Class/ in your project. Currently that version of Farseer Physics is nearly identical with the Box2D.XNA version, but it is not dependent on the XNA framework.

I know these options sound kind of complicated, but once Farseer Physics 3.0 is actually released (sorry no dates on that) then you should have one of the most complete physics engines for C# at your disposal with a ton of examples.
function to not do anything or draw using System.Forms.Drawing instead of XNA.
บาคาร่า

Original thread: https://box2d.org/forum/viewtopic.php?t=4230