The program below throws an exception in Emgu.CV.MatInvoke.cveMatCreateData(IntPtr mat, Int32 row, Int32 cols, Int32 type) after a varying number of iterations each time it is run. I'm using Visual Studio 2010 and the .NET Framework version 4.6 on Windows 7 64-bit.
using Emgu.CV;
using Emgu.CV.CvEnum;
namespace EmguCV_crasher_2
{
class Program
{
static void f(int ii)
{
for (var i = 0; i < 100; i++)
{
// Unhandled exception occurs in Mat().
// Iteration causing exception varies. Can be ii = 277, i = 43.
// Stack trace:
// at Emgu.CV.CvInvoke.CvErrorHandler(Int32 status, IntPtr funcName, IntPtr errMsg, IntPtr fileName, Int32 line, IntPtr userData)
// at Emgu.CV.MatInvoke.cveMatCreateData(IntPtr mat, Int32 row, Int32 cols, Int32 type)
// at Emgu.CV.Mat.Create(Int32 rows, Int32 cols, DepthType type, Int32 channels)
// at Emgu.CV.Mat..ctor(Int32 rows, Int32 cols, DepthType type, Int32 channels)
// at EmguCV_crasher_2.Program.f(Int32 ii) in C:\Visual Studio 2010\Projects\EmguCV_crasher_2\EmguCV_crasher_2\Program.cs:line 17
// at [etc.]
var m = new Mat(128, 128, DepthType.Cv32F, 1);
}
}
static void Main(string[] args)
{
for (var i = 0; i < 1000; i++)
{
f(i);
}
}
}
}