Often my program crash by some reason. In this case I do see Windows message with "Close" button. Every time such thing happen I do really want to know what happened.
Thanks to community I already know how to "handle" some situations, I've added such code in the beggining of my program:
static void Main(string[] args)
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
TaskScheduler.UnobservedTaskException +=
(object sender, UnobservedTaskExceptionEventArgs excArgs) =>
{
Log.Push(LogItemType.Error, "Exception occured. Task terminated! + " + excArgs.Exception);
excArgs.SetObserved();
};
.....
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Console.WriteLine("Error: CurrentDomain_UnhandledException entered.");
string message = (e.ExceptionObject as Exception).Message;
Console.WriteLine(message);
System.Diagnostics.Trace.WriteLine(message, "Unhandled UI Exception");
Log.Push(LogItemType.Error, message);
}
Sometimes this helps. But sometimes program just crash with no message. What else can I do? Every time program crash I want to know why.
upd Windows Logs contains almost everything I need, except the most important thing - the stacktrace
Faulting application name: MBClient.exe, version: 1.0.0.0, time stamp: 0x50a5da1d
Faulting module name: ntdll.dll, version: 6.1.7601.17725, time stamp: 0x4ec4aa8e
Exception code: 0xc0000374
Fault offset: 0x00000000000c40f2
Faulting process id: 0x10f8
Faulting application start time: 0x01cdc3c2041e2607
Faulting application path: C:\Oleg\bin\mbclient\MBClient.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: 810c805d-2fc3-11e2-bfb5-2c768a509157
Exception code 0xc0000374 means you're facing heap corruption.
The most common causes for this kind of error are these two:
You probably have to get Windows Debugging Tools to figure out what's wrong if you can't debug the application in the dev environment.
You can try to use the WER - Microsofts Windows Error Reporting for that. It is per default on every system. So e.g. you can do an automatic dump instead of the windows popup message.
There are a number of settings in the group policy editor.
see the following links
http://msdn.microsoft.com/en-us/library/windows/desktop/bb787181(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/bb513638%28v=vs.85%29.aspx
I know this is an old question, but I came here after googling the exception code 0xc0000374.
There is an update available for the MS Visual C++ 2013 Redistributable package that fixes a heap corruption bug in the MS Visual C++ 2013 redistributable package.
Note: This update is (at time of writing) not being distributed through Windows Update. Note 2: Obviously, this update will only help, if you are using a library compiled with MS VC++ 2013 (like in my case: the MySQL ODBC Connector 5.3.x)
The update link: https://support.microsoft.com/en-us/help/3138367/update-for-visual-c-2013-and-visual-c-redistributable-package
And the source that pointed me to this update: https://bugs.mysql.com/bug.php?id=86054
Just use try catch at "risky" parts of your code where you think it could crash.
User contributions licensed under CC BY-SA 3.0