I have an application that I've written that crashes intermittently, but I'm unable to capture an exception at the application layer. I always get an entry in the event log but doesn't give me much info:
Faulting application name: BCS-UI.exe, version: 1.0.11.0, time stamp: 0x5c0edcbd
Faulting module name: ntdll.dll, version: 10.0.17134.376, time stamp: 0x4358e406
Exception code: 0xc0000374
Fault offset: 0x000d8829
Faulting process id: 0x39b0
Faulting application start time: 0x01d49161c80079a0
Faulting application path: C:\Gogs Local\SMR_Windows_UI\BCS-UI\BCS-UI\bin\Release\BCS-UI.exe
Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll
Report Id: 1fbc4761-d256-44b0-99b0-4d9d758e4fe0
Faulting package full name:
Faulting package-relative application ID:
- System
- Provider
[ Name] Application Error
- EventID 1000
[ Qualifiers] 0
Level 2
Task 100
Keywords 0x80000000000000
- TimeCreated
[ SystemTime] 2018-12-11T15:12:28.109191000Z
EventRecordID 23318
Channel Application
Computer Leviathan
Security
- EventData
BCS-UI.exe
1.0.11.0
5c0edcbd
ntdll.dll
10.0.17134.376
4358e406
c0000374
000d8829
39b0
01d49161c80079a0
C:\Gogs Local\SMR_Windows_UI\BCS-UI\BCS-UI\bin\Release\BCS-UI.exe
C:\WINDOWS\SYSTEM32\ntdll.dll
1fbc4761-d256-44b0-99b0-4d9d758e4fe0
As you can see, I get this:
Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll.
I'm not sure what that is or how it relates to the crashes, but I've been able to reproduce it on multiple machines and I'm at a loss on how to determine the cause or prevent it from happening.
Update: I've gotten to a point where the application crashes on startup with the above reason. It gets to the end of the MainWindow constructor (it is a WPF application), sits there for about 10 seconds on a white screen and then dies. I've rolled back to older versions of the software and reproduced this behavior. I have also moved it to another machine and did NOT see this behavior, so my current theory is in agreement with what was said in the comments - that something corrupted the heap and it only gets cleared up on a reboot.
Update 2: I'm able to produce this error message when running outside of the debugger, although when running in the debugger, I'm not able to get it to stop on an exception:
a generic error occurred in GDI+
So that's what I'll be hunting today. Interestingly and disturbingly enough, the app crashes every time on startup, even after rebooting. The same behavior does not occur on other machines at this time.
To debug these kind of system internal issues, I suggest you try Process Monitor.
Process Monitor is an advanced monitoring tool for Windows that shows real-time file system, Registry and process/thread activity.
Basically you need to look out for the "NAME NOT FOUND" errors, which means missing dlls or registry keys, or any other suspisious errors in the monitor screen.
The last time I had a similar crash in my app that pointed to ntdll.dll as the faulting module, the reality was that my own code had a memory leak. I did a strcpy on a string that was not allocated memory. Something like,
char * str;
strcpy(str, "Hello");
I found this after a strenuous walkthrough of my code.
Check your code for leaks.
For those having a similar issue and only get this error but nothing else:
A breakpoint instruction (__debugbreak() statement or a similar call) was executed
Try update the NuGet packages in your solution.
As soon as I updated a handful of Microsoft packages, that mysterious error stopped occurring.
Related
I've been re-writing an app and run into (again :-( ) that it's working in both Debug and Release modes, but the packaged app crashes on launch. i.e. never even gets to the app's home screen. I had this happen first time around, but eventually solved it from Googled results, however this time I've reached a dead-end and not sure what else I can do. Things I tried previously and worked but no effect this time...
deleted all .vs folders, clean, build.
tick "compile with .net native tool chain" (in fact that is now ticked by default I found. So I tried turning it off, and the packaging then failed with some error about the manifest not matching something now)
3 I may be able to adapt, but not sure how yet. Last time I had ZXing in the app, and that ended up being the problem. It was solved by adding
List<Assembly> assembliesToInclude=new List<Assembly>();
assembliesToInclude.Add(typeof(ZXing.Net.Mobile.Forms.WindowsUniversal.ZXingScannerViewRenderer).GetTypeInfo().Assembly);
Xamarin.Forms.Forms.Init(e,assembliesToInclude);
I don't have ZXing in the new app yet, BUT one package I've added that I had before is CsvHelper, so I suspect that may be the cause. Note that my previous version of the packaged app was working before I added it, so that adds to the suspicion.
But I can't find anyone who has run into this, so I'm not sure how I can find what assemblies would need to be added? (when it happened with ZXing, I just copied what someone else had said. They in fact had listed a whle bunch of ZXing assemblies, but I ended up being able to narrow it down to one by adding all and then taking away one at a time)
So...
any ideas on how to find what CsvHelper assemblies might need to be added? i.e. how do I even find what assemblies it has in it to begin with?
any other suggestions? This is the error I'm getting from the Windows Event Viewer - not sure if any of these numbers actually tell me anything useful, and if so which ones and how?
Faulting application name: Myappname.UWP.exe, version: 1.0.0.0, time stamp: 0x62158bed
Faulting module name: KERNELBASE.dll, version: 10.0.19041.1503, time stamp: 0xb2acaea9
Exception code: 0xc000027b
Fault offset: 0x000000000010b382
Faulting process ID: 0x5660
Faulting application start time: 0x01d82857d5105201
Faulting application path: C:\Program Files\WindowsApps\00bf2865-c554-4952-9142-753983df67d5_0.3.0.0_x64__b71kk8c7kdz5g\Myappname.UWP.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report ID: fb10dc41-a7f1-4d74-ad8e-befa62556dcc
Faulting package full name: 00bf2865-c554-4952-9142-753983df67d5_0.3.0.0_x64__b71kk8c7kdz5g
Faulting package-relative application ID: App
Thanks,
Donald.
I am running a .Net console application that executes 24 hrs a day. It has a bug that occurs about once every 6 days.
I would like your assistance to fix this bug. First I will provide some background, and then I will provide the exception messaging.
Unfortunately I do not have steps to reproduce. You will see why as you read on.
First some background:
I have robust exception handling in my code (or so I thought). For example I have a try...catch block in my Main() method that captures any unhandled exceptions and if they are FATAL it restarts the underlying task. It works great for any exceptions generated from my own code.
I cannot explain why the below exception isn't handled in my code. My best guess is that clr.dll exceptions do not get caught within the managed stack. And if that is the case, I do not know how to generate a stack trace. I don't even know where to begin to fix this.
The process I am running is using the following versions and modules:
C# .Net Framework 4.6.1
Console App project type
System.Net.WebClient
log4net
Windows 7 64-bit
At the time of the crash I checked RAM and HDD: both have plenty of free space.
About the code I'm executing. The process is a continous loop that downloads data from a website and saves it to a text file. If there is an error, it is logged using log4net.
The basic loop is this:
for (int i = 0; i < 5; i++)
{
try
{
return new WebClient().DownloadString(url);
}
catch
{
Thread.Sleep(500); // slow it down.
}
}
The following is the only message that displays in my console window when the exception occurs: (no stack trace displayed)
Process is terminated due to StackOverflowException
My console application completely freezes up and a dialog window pops up with the following information (closing this dialog also terminates my application)
Problem signature:
Problem Event Name: APPCRASH
Application Name: foo.goo.BatchExecutor.exe
Application Version: 1.0.0.0
Application Timestamp: 5a50f3eb
Fault Module Name: clr.dll
Fault Module Version: 4.7.2117.0
Fault Module Timestamp: 59cf5105
Exception Code: c00000fd
Exception Offset: 0002429f
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1033
Additional Information 1: 28e8
Additional Information 2: 28e8aacd8abfe32876bc8363e8e5c526
Additional Information 3: 6916
Additional Information 4: 6916665ca52ff482d854f190abcf46b2
The only other place I could find information about the crash is in the Windows Event Log:
Log Name: Application
Source: Application Error
Date: 1/23/2018 5:51:46 PM
Event ID: 1000
Task Category: (100)
Level: Error
Keywords: Classic
User: N/A
Computer: FOOGOO
Description:
Faulting application name: foo.goo.BatchExecutor.exe, version: 1.0.0.0, time stamp: 0x5a50f3eb
Faulting module name: clr.dll, version: 4.7.2117.0, time stamp: 0x59cf5105
Exception code: 0xc00000fd
Fault offset: 0x0002429f
Faulting process id: 0x1e00
Faulting application start time: 0x01d39169354e41a7
Faulting application path: C:\Users\Owner\Desktop\SHARED\foo.goo.BatchExecutor\foo.goo.BatchExecutor.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Report Id: 21b9b2a4-00a9-11e8-9f6c-94c69110a719
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Application Error" />
<EventID Qualifiers="0">1000</EventID>
<Level>2</Level>
<Task>100</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2018-01-24T01:51:46.000000000Z" />
<EventRecordID>1852</EventRecordID>
<Channel>Application</Channel>
<Computer>FOOGOO</Computer>
<Security />
</System>
<EventData>
<Data>foo.goo.BatchExecutor.exe</Data>
<Data>1.0.0.0</Data>
<Data>5a50f3eb</Data>
<Data>clr.dll</Data>
<Data>4.7.2117.0</Data>
<Data>59cf5105</Data>
<Data>c00000fd</Data>
<Data>0002429f</Data>
<Data>1e00</Data>
<Data>01d39169354e41a7</Data>
<Data>C:\Users\Owner\Desktop\SHARED\foo.goo.BatchExecutor\foo.goo.BatchExecutor.exe</Data>
<Data>C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll</Data>
<Data>21b9b2a4-00a9-11e8-9f6c-94c69110a719</Data>
</EventData>
</Event>
*****UPDATE WITH SOLUTION WORKAROUND *****
I have given up trying to handle this exception within .Net. I found an effective workaround. This workaround applies to Windows, specifically any version with an Event Viewer.
Workaround Instructions.
1) Open control panel->Admin Tools->Event Viewer->Windows Logs->Applications.
2) Select the offending event. In my case, it is state ERROR, and matches the example that you see above.
3) On the right hand side click "Attach Task to This Event".
4) Complete the wizard. In my case, I restart my application.
5) Save the task.
6) Now switch over to Task Scheduler and find the task. Click Properties. Click through the tabs and configure the Task as you see fit.
*****UPDATE WITH SOLUTION WORKAROUND *****
I have given up trying to handle this exception within .Net. I found an effective workaround. This workaround applies to Windows, specifically any version with an Event Viewer.
Workaround Instructions.
1) Open control panel->Admin Tools->Event Viewer->Windows Logs->Applications.
2) Select the offending event. In my case, it is state ERROR, and matches the example that you see above.
3) On the right hand side click "Attach Task to This Event".
4) Complete the wizard. In my case, I restart my application.
5) Save the task.
6) Now switch over to Task Scheduler and find the task. Click Properties. Click through the tabs and configure the Task as you see fit.
I suggests to use ProcDump, it can be configured to generate a crash dump when the StackOverflowException occurs.
procdump -accepteula -e 1 -f C00000FD.STACK_OVERFLOW -g -ma <PID> <OUTPUT PATH>
Then analyze the dump file using one of this tools
Visual studio, windbg, debugdiag, clrmd.
I suggest trying DebugDiag (https://www.microsoft.com/en-us/download/details.aspx?id=49924) to capture the crash and analyse the resulting process dump. Make sure you include pdbs alongside your exe, to make diagnosis easier: in the Project properties, Build tab: set the Configuration to the configuration that you use to build the exe. In the Output section, Advanced button, set the Debugging information to Pdb (or Full).
To help collect a stack trace, PHPTower, you can do what I did and subscribe to the AppDomain.CurrentDomain.UnhandledException event of your program at the beginning of your Main() function
The signature of the event handler looks like the following, allowing you to get the exception, and output a stack trace with the Exception.ToString() method.
private static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
File.AppendAllLines(FileName, e.ExceptionObject.ToString());
}
Happy hunting!
-cadatoiva
My programm is running without any problems, on my current laptop (x64). But when I try to run it on an other PC (x86) it crashes before starting. I also tried to change the platformtarget, as described in this answer:
XMLParseException occurs
I also catched all unhandled exceptions. That delivers me two exceptions:
I also got that from reliability history:
Faulting application name: LoginDemo.exe, version: 1.0.0.0, time
stamp: 0x56c19003 Faulting module name: KERNELBASE.dll, version:
6.1.7601.17651, time stamp: 0x4e2111c0 Exception code: 0xe0434352 Fault offset: 0x0000d36f Faulting process id: 0x4b0 Faulting
application start time: 0x01d167cd96535e01 Faulting application path:
C:\Users\hgservice\Desktop\Temp\LoginTool2\LoginDemo\bin\Release\LoginDemo.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll Report Id:
d6435b26-d3c0-11e5-b9a7-001999d6cbe5
I also read that the problem could occure because the programm tries to import a DLL while running, but all DLLs that I need for the exe are in the same folder. And as I said on my laptop it is working fine. Has anyone an idea what the problem could be?
This problem has nothing in common with WPF as such. If we analyse the stacktrace we can see that it is thrown by pcsc-sharp library. The more careful analysis will show that NoServiceException exception was thrown because the following native method returned an error:
[DllImport(WINSCARD_DLL, CharSet = CharSet.Auto)]
private static extern int SCardEstablishContext(...)
More precisely NoServiceException is mapped to the SCARD_E_NO_SERVICE (0x8010001D) error. It means that probably SmartCard service on your laptop is not running. To fix it: press Win+R, type services.msc and start SmartCard service.
This problem can be also caused by differences between various versions of Windows (for details see this question).
Another cause of this problem might be the lack of sufficient permissions (see this article).
Okay guys I fixed it. As Michał Komorowski and Jon Skeet already answered, the problem was that the Smard Card sevice was not running. The answer of Michał Komorowski is almost correct. The only thing I had to do furthermore, was to set the startup type on "manual". After that I could start the Smart Card service and now everything is working.
So I've developed a program in C# in VS2013 that utilizes TAPI to make a phone call on 1 button. Originally I used the TAPI3 library, but after discovering its not in a working state I switched to JulMar's TAPI 2 wrapper. I'm using Windows 8 64 bit, and although the program is used elsewhere only on Win8 64 bit machines does this issue occur.
Whenever I make a phone call from my program, nothing abnormal happens and the phone call is made. Code runs and everything is OK. But when I close the form where TAPI is used (i.e terminating tapisrv.exe) the service shuts down, and then drags other processes with it every time. This is interfering with drive mappings, cryptography services and other services depending on the PC. The error log in event viewer is below;
Faulting application name: svchost.exe_TapiSrv, version: 6.3.9600.17415, time stamp: 0x54504177
Faulting module name: ntdll.dll, version: 6.3.9600.18007, time stamp: 0x55c4c16b
Exception code: 0xc0000008
Fault offset: 0x000000000009311a
Faulting process ID: 0xd4
Faulting application start time: 0x01d0f45613fffb86
Faulting application path: C:\Windows\system32\svchost.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report ID: 41b6967a-604a-11e5-829f-f8b156d8c3e7
Faulting package full name:
Faulting package-relative application ID:
I also get an information bubble following it with the following information:
Fault bucket , type 0
Event Name: APPCRASH
Response: Not available
Cab Id: 0
Problem signature:
P1: svchost.exe_TapiSrv
P2: 6.3.9600.17415
P3: 54504177
P4: ntdll.dll
P5: 6.3.9600.18007
P6: 55c4c16b
P7: c0000008
P8: 000000000009311a
P9:
P10:
Attached files:
C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\WERE5B1.tmp.appcompat.txt
C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\WERE5D1.tmp.WERInternalMetadata.xml
C:\ProgramData\Microsoft\Windows\WER\ReportQueue\AppCrash_svchost.exe_Tapi_881875fa9eb711f34fe5d53182d2b0c47578647_f1915213_cab_053de5df\memory.hdmp
C:\ProgramData\Microsoft\Windows\WER\ReportQueue\AppCrash_svchost.exe_Tapi_881875fa9eb711f34fe5d53182d2b0c47578647_f1915213_cab_053de5df\triagedump.dmp
These files may be available here:
C:\ProgramData\Microsoft\Windows\WER\ReportQueue\AppCrash_svchost.exe_Tapi_881875fa9eb711f34fe5d53182d2b0c47578647_f1915213_cab_053de5df
Analysis symbol:
Rechecking for solution: 0
Report ID: 41b6967a-604a-11e5-829f-f8b156d8c3e7
Report Status: 4
Hashed bucket:
Has anybody seen this before? Am I doing something wrong? I know other issues exist regarding TAPI on win8 64 bit but I cant seem to find this specific problem.
Thanks in advance.
My guess: You have a buggy TSP that crashes your service when the TAPI is uninitialized.
I know no such crashes just from the TAPI. If the crash happens inside the service there is always a TSP involved in such problems.
Try to run the TAPI service isolated in its own service host. This will prevent troubles when the service crashes.
Open the created DMP files with your VS you received and check what DLL / code causes the crash.
I found running TapiSrv in its own group at least isolates the crash to itself. Run the following in an elevated command prompt:
sc config Tapisrv type= own
I'm currently writing a file scanning utility and am using IFilters in a WinForms application.
I moved the code that scans the files to a Backgroundworker and since I have done that the PDF IFilter application is throwing errors.
This is the error I'm getting in the event log:
Faulting application name: Scanner.vshost.exe, version: 11.0.50727.1, time stamp: 0x5011d445
Faulting module name: PDFL60.dll, version: 6.1.0.0, time stamp: 0x40bcc106
Exception code: 0xc0000005
Fault offset: 0x0000a3c5
Faulting process id: 0x1e8
Faulting application start time: 0x01ce9f4fc83fac44
Faulting application path: C:\Development\Scanner\Scanner\bin\Debug\Scanner.vshost.exe
Faulting module path: C:\Program Files\Adobe\PDF IFilter 6.0\PDFL60.dll
Report Id: 6a4c3638-0b44-11e3-bb16-082e5f03ae88
The worrying thing is that it is taking VSHost out and doesn't happen on every PDF. Some of the them are fine.
Has anyone else had this error or can anyone shed any light on what might be causing it ?
It seems that the latest IFilters in Adobe 8 onwards only support the stream interface used by the Search indexer in Windows. This explains why I was getting 'no interface supported' using the latest versions.
V6.0 of the IFilter becomes flaky when not used in a single threaded application as can be seen here
The first solution I came across was to use Foxit PDF IFilter which works like a charm and if I could squeeze $600 out of my client would certainly buy. I had no problems running using this IFilter.
The second and free solution was to use the Adbobe IFilter 5.0. Nearly 10 years old but implements the file interface and is stable.
Another solution might be to switch to 64 bit. V9.0 of the 64 bit filter from Adobe is working and is stable.