Unhandled microsoft c++ exception cv exception at memory location - c++

I currently developped a project with VS and OpenCV on my x64 computer and i've a problem with this line:
model->train(image, labels);
image and labels are not empty but i've got this error:
Unhandled exception at at 0x774FC42D in facerec_video.exe: Microsoft C++ exception: cv::Exception at memory location 0x0015EF38.
If i click "continue", program continue and works.
Furthermore, if i set a breakpoint on this line and do a step by step, error message doesn't appear and program works too.
How to resolve this problem ?
Thanks

Related

DXRSDK_v0.09.01 can not run on visual studio 2017

I tried to run this sample code in release mode, but it fails to run because of the following message:
Unhandled exception occurred (0x00007FF831F1A388, D3D12RaytracingHelloWorld.exe): Microsoft C ++ Exception: HrException, memory location 0x00000043891FF778. Occur
This message may not be accurate because it is a translation of Korean into English. I do not know how to handle this. I would appreciate your help. If you would like to approach this issue, the following site address is provided.

Visual studio 2017 output window entity framwork exception

Why am I getting this in the output window:
Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.SqlServer.dll
Is there any way to see where the exception is thrown from and why this is ?
Debug > Windows > Exception Settings, tick the box for CLR exceptions was what I was looking for.

error during VS Debugging but no error when run exe file directly

I have a very simple c++ sample project that basically just logs in to a 3rd party library (collection of .lib files)
There are 4 provided configurations md,mdd,mt,mtd. All x64.
I can build in mdd mode and run the Exe file directly, and the program works fine.
But if I run the debugger in VS, the 3rd party library throws a runtime Exception "vector deleting destructor".
try
{
engine = new Engine(&params);
}
catch (XxxException& Ex)
{
return (ERROR);
}
Exception thrown at 0x00007FFA52003FB8 in Sample.exe: Microsoft C++ exception: XxxException at memory location 0x000000224C53F190.
Exception thrown at 0x00007FFA52003FB8 in Sample.exe: Microsoft C++ exception: XxxException at memory location 0x000000224C53F690.
0x00007ff75d5ab3e0 {Sample.exe!const XxxException::`vftable'} {0x00007ff75d2d8a50 {Sample.exe!XxxException::`vector deleting destructor'(unsigned int)}}
So I am unable to debug.
What is this error, and why does it only occur in VS Debugger?
The solution was to change the working directory as specified in Debugging from $(ProjectDir)
to $(TargetPath), where the exe was sitting!
isn't C++ a wonderful artifact of history!

SFML 2.2 Unhandled exception at 0x00007FFA622C21F9(sfml-system-2.dll)

I'm trying to build a game in sfml under windows 10.It shows successful at the time of building.whenever i debug the solution it shows the error message like:
Unhandled exception at 0x00007FFA622C21F9 (sfml-system-2.dll) in picpuz2.exe: 0xC0000005: Access violation reading location 0x0000000000000019.
Under call stack the program stopped at the code:
window.create(sf::VideoMode(300, 300, 32), "PICPUZ");
This is my code:
Please follow the tutorials closely. If you are doing a debug build, you should link with the dlls that end in -d for debug.
For example sfml-system-d-2.dll
Linking release and/or debug to the wrong configuration (release to debug or debug to release) will result in unpredictable crashes.

OpenCV Build ok, debug throws error, runs fine from .exe

Using Visual Studio 2010, OpenCV 2.2.2, Windows 7 64x
My code builds successfully then when it goes into debug I get the following error:
First-chance exception at 0x75f0c41f in MachineVisionHW0.exe: Microsoft C++ exception: cv::Exception at memory location 0x002dec90..
Unhandled exception at 0x75f0c41f in MachineVisionHW0.exe: Microsoft C++ exception: cv::Exception at memory location 0x002dec90..
Then I end debug, go to the file directory and run the built executable and it runs fine. Does anybody know how to fix this? It isn't keeping me from building my code, but it is incredibly inconvenient. I will include an example of the code that is doing this below.
int main(){
cv::Mat image1 = cv::imread("img1.JPG", CV_LOAD_IMAGE_GRAYSCALE);
cv::namedWindow("Sample1");
cv::imshow("Sample1", image1);
cv::waitKey(0);
return 1;
}
Do you get the unhandled exception before main?
If not, then your code is somehow doing something to raise the exception. Put a breakpoint on the first line, then hit F5, then once at the breakpoint, step through the code one line at a time to see which one causes the exception, F10 key to do this.
My gut feeling is that when running from the debugger, the cv::imread is failing since it is not finding the img1.jpg from the expected location, the current working directory is that of the solution file, not of the debug output build dir. You can do a quick test and copy the img1.jpg to the dir containing the sln file and see if that fixes the problem.