No stack trace on exception - visual-studio

I have .NET application that sometimes happily catches System.OutOfMemory (of unknown origin). I tried to debug it by attaching visual studio to it, but when exception happened, visual studio was unable to show me any stack trace. How can I get the stack trace?

You should try to wrap any code that could result in an exception with a try-catch and then put a breakpoint on the catch statement of every try catch. So when you attach VS to it you will be able to analyse the Exception when the breakpoint has been triggered.
If you have a Main method wrap all the code in a try-catch and that might allow you to catch any exceptions that might be raised.

Related

Unhandled exception in debugging

During debugging my project, i am getting the an unhandled exception. I am new in debugging using visual studio 2017 , Can anyone give me any approach or idea to remove this exception? Due to this my application crashes. I am attaching the exact exception statement below.
Unhandled exception at 0x76442552 in someprocess.exe: Microsoft C++ exception: std::runtime_error at memory location 0x1C00F258.
Unhandled exception in debugging
Usually, the issue is caused by your code.And from the description, the error is from info.hasException.
Please make sure that when you define info property, you should set a default value to it like NULL;
You should check very carefully and make sure that info has value and its type is right.
Also, please provide a small sample about your project to help us troubleshoot the issue more quickly.

exception thrown when debug single stepping vs2017

I'm trying to single step (F10/F11) through my code, but it doesn't work. It always throws a "Access violation writing location 0x0000" exception from within ntdll.dll.
When running the program straight it works fine. The exception is only thrown when single stepping. It doesn't matter where in the code the single step occurs I can place a BP at random somewhere in the code, run the program to the BP and then single step from the BP. That hit's the exception.
When starting the program in single step (F10) I can't even execute the first statement.
Does anybody have any ideas?
When disabling native code debugging it works. However without native code debugging you can't debug unmanaged code anymore.
That makes work a bit akward. When debugging code within a unmanaged DLL you have to enable "native code debugging" set the BP inside the DLL code. Single stepping within the DLL works. Once you're done and go back to managed code you have to disable "native code debugging".
Weird.

Visual studio 2010 first chance exception KernelBase.dll : 0x000006BA: Win32 exception

I am getting this on a build right after the line that says this:
Loaded 'c:\Windows\SysWOW64\msimg32.dll', Symbols loaded (source information striped).
That is the last thing I see when the program DOES NOT open in debug.
When it DOES open in debug I get the following after that line:
First-chance exception at 0x75f0c42d (KernelBase.dll) in xxx.exe: 0x000006BA: The RPC server is unavailable.
Most of the time I get the first case so I have to keep stopping the debug and starting it until the program comes up with the 2 case.
I have tried setting a break point for that exception from info I found on here already but even if i comment it out, i still get the first case with no program opening for debug.
I have tried using Microsoft Symbol Servers and without.
I am not sure what else to try as I am only getting the program running about 1 tries in 6.

Visual Studio strange startup exception

For some reason VS was not breaking on exception when running in debug mode, so I followed the advice given here to go to Debug -> Exceptions and enable the CLR exceptions. I now get this error:
System.Globalization.CultureNotFoundException occurred
Message=Culture is not supported.
Parameter name: name
uploads is an invalid culture identifier.
Source=mscorlib
ParamName=name
InvalidCultureName=uploads
StackTrace:
at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
InnerException:
This error occurs on startup, but only some of the time.
The advice here then recommends that I do the exact opposite and uncheck the debug the CLR option, but I am then back to square one! A poster suggests that it is a bug, but the post is two years old, so surely that has been fixed by now.
I am not using globalisation.

Problem with Debugging in C++ Builder 2009

I have a strange problem, I hope you can help me.
I write a program in C++ Builder 2009, when I run the program without debugger I see an Exception raised. bun in debugger never exception raised and I cant find the exception point.
And Also I enable the CodeGaurd in C++ for Finding the problem but the Exception never raised, If I disable codeGuard the exception will be here again.
I use OpenCV and some Delphi units in the program.
And when I compile it I see more than 2 millions of code line compiled.
Thanks in advance for your attentoin.
A few things too look at:
in the IDE options, make sure you are not ignoring some exceptions
debug builds MAY have memory variables set to NULL on run, release builds will not. Make sure you are running the same build (Debug) in both the IDE and without.
Ignore the line count that is displayed, its all those .hpp files that holds the vcl headers.

Resources