When I use the "Play with your peas" Designer generated PNG, Blend fails

Mar 8, 2010 at 7:42 PM

There appears to be a failure mode in Physics Helper, which I think is a great project, when I attempt to use PNG images generated in Expression Designer and exported. 


  • The example of this problem can be reproduced by opening and exporting the "Play with your Peas" images in the the Expression Designer samples file.
    • C:\Program Files\Microsoft Expression\Design 3\Samples\PlayWithYourPeas.design

Error code:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8)
Timestamp: Mon, 8 Mar 2010 19:40:43 UTC

Message: Unhandled Error in Silverlight Application [Arg_IndexOutOfRangeException]
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=3.0.50106.0&File=mscorlib.dll&Key=Arg_IndexOutOfRangeException   at Spritehand.FarseerHelper.BoundaryHelper.GetNextVertex(UIElement element, Point current, Point last, Double left, Double top, Double width, Double height, WriteableBitmap bitmap)
   at Spritehand.FarseerHelper.BoundaryHelper.GetPointsForImage(Image element, UIElement containerElement, Boolean positionOnly)
   at Spritehand.FarseerHelper.BoundaryHelper.GetPointsForElement(UIElement element, UIElement containerElement, Boolean positionOnly)
   at Spritehand.FarseerHelper.PhysicsSprite..ctor(PhysicsSimulator physicsSim, Canvas parentCanvas, UIElement element, List`1 points, Boolean showDebug, Single defaultFriction, UIElement boundaryElement)
   at Spritehand.FarseerHelper.PhysicsControllerMain.AddPhysicsBody(PhysicsObjectMain physObject)
   at Spritehand.PhysicsBehaviors.PhysicsObjectBehavior.controller_Initialized(Object source)
   at Spritehand.FarseerHelper.PhysicsControllerMain.InitializedHandler.Invoke(Object source)
   at Spritehand.FarseerHelper.PhysicsControllerMain._timerInitialize_Completed(Object sender, EventArgs e)
   at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
Line: 1
Char: 1
Code: 0
URI: http://localhost:49922/Silverlight.js


Mar 8, 2010 at 9:42 PM

In reading the posts on this issue, the "Play with your peas" generates a "clean" image, with no extra pixels.  Using Paint.NET did not solve the problem. 

Mar 8, 2010 at 9:51 PM

I exported a "Pea-Happy.png" and looked at it in Paint.NET, and I noticed that there are some pixels that are right on the border of the PNG image (they are semi-transparent, and blended). I'm guessing these are the culprit.

So I think if you create a slightly bigger, blank PNG (maybe 40x40 pixels) and then paste in the pea (37x37 pixels), then the boundary detection will be happy...

Mar 8, 2010 at 10:23 PM

I have found this to be the case with many PNGs.  Unfortunate. 

Tested and that did it. 

Thank you.