1
DotNet / 'System.AccessViolationException' when using Inversetransform on a sprite
« on: June 26, 2013, 01:21:56 pm »
I'm not sure if this is a bug or if I'm fundamentally misunderstanding how this function works, but whenever I call InverseTransform on a sprite it crashes with "'System.AccessViolationException' occurred in mscorlib.dll".
Note that in the testcase I get the transform then call GetInverse, so that I could isolate the problem the the inversion of the transform.
namespace Testcase
{
class Program
{
static void Main(string[] args)
{
Sprite sp1 = new Sprite(new Texture("test.png")); //16*16 image
sp1.Transform.Translate(1, 1); // make sure it has a transform applied
Transform step1 = sp1.Transform;
Transform step2 = step1.GetInverse(); //crashes here
}
}
}
{
class Program
{
static void Main(string[] args)
{
Sprite sp1 = new Sprite(new Texture("test.png")); //16*16 image
sp1.Transform.Translate(1, 1); // make sure it has a transform applied
Transform step1 = sp1.Transform;
Transform step2 = step1.GetInverse(); //crashes here
}
}
}
Note that in the testcase I get the transform then call GetInverse, so that I could isolate the problem the the inversion of the transform.