How to resolve problem with StackOverflowException on MVC Core - c#

There is problem with hosting application on IIS by VS2017 (15.9.3). I have MVC app write in .NET Core 2.0 with enabled logging on web.config
stdoutLogEnabled="true" stdoutLogFile="c:\Logs\log.txt"
After any request is made I get 502.3 error.
HTTP Error 502.3 - Bad Gateway The specified CGI application
encountered an error and the server terminated the process.
On my log file there is short info:
Process is terminating due to StackOverflowException.
On EventViewer I get more descriptive error:
Faulting application name: w3wp.exe, version: 7.5.7601.17514, time
stamp: 0x4ce7afa2
Faulting module name: ntdll.dll, version: 6.1.7601.24260, time stamp:
0x5b9470be
Exception code: 0xc000070a
Fault offset: 0x00000000000139d7
Faulting process id: 0x2304
Faulting application start time: 0x01d48723e2a88740
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll
Report Id: f7ca32d0-f31c-11e8-83db-1c4d70da3d0a
Exception is probably generated by something in my code, maybe configuration of sth is wrong, but how can I find reason of it?
What could be the best strategy to find solution?

Related

When the desktop bridge application uses the update API, disconnecting the network will cause the app to crash

Using StoreContext.CanSilentlyDownloadStorePackageUpdates when the network is disconnected will cause the app to crash, and I try to use Try-Catch to fail to catch this exception.
In addition, when I use StoreContext.TrySilentDownloadStorePackageUpdatesAsync to download the update package, disconnecting the network at this time will also cause the APP to crash too.
Code snippet:
[System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptions]
public bool CanSilentlyUpdate()
{
try
{
//There will be an error:
// System.AccessViolationException :“Attempted to read or write protected memory.
// This is often an indication that other memory is corrupt.”
return StoreContext.GetDefault().CanSilentlyDownloadStorePackageUpdates;
}
catch (Exception ex)
{
Debug.WriteLine(ex);
return false;
}
}
The following is the error log in Event Viewer:
Eventlog 1: Application: MyApp.exe Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException at
Windows.Services.Store.StoreContext.get_CanSilentlyDownloadStorePackageUpdates()
Eventlog 2: Faulting application name: MyApp.exe, version: 1.0.0.0,
time stamp: 0x96223b82 Faulting module name:
Windows.ApplicationModel.Store.dll, version: 10.0.19041.329, time
stamp: 0x92fa3e59 Exception code: 0xc0000005 Fault offset: 0x0009fcb0
Faulting process id: 0x6d0c Faulting application start time:
0x01d6511c5d86de48 Faulting application path: C:\Program
Files\WindowsApps\MyApp\MyApp.exe Faulting module path:
C:\Windows\System32\Windows.ApplicationModel.Store.dll Report Id:
d67098d6-39c7-4a02-a837-b523821c9ca2 Faulting package full name: MyApp
Faulting package-relative application ID: App
Eventlog 3: Application: MyApp.exe Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: exception code c0000005, exception address 7947FCB0
Stack:
Eventlog 4: Faulting application name: MyApp.exe, version: 1.0.0.0, time
stamp: 0x96223b82 Faulting module name:
Windows.ApplicationModel.Store.dll, version: 10.0.19041.329, time
stamp: 0x92fa3e59 Exception code: 0xc0000005 Fault offset: 0x0009fcb0
Faulting process id: 0x36a0 Faulting application start time:
0x01d65131af3782e2 Faulting application path: C:\Program
Files\WindowsApps\MyApp\MyApp.exe Faulting module path:
C:\Windows\System32\Windows.ApplicationModel.Store.dll Report Id:
4a027389-345c-4f16-a605-276f2774c768 Faulting package full name: MyApp
Faulting package-relative application ID: App
This kind of exception seems to be unable to be caught using managed code, what should I do?
After discussing with other engineers, it looks like there is no other way to handle it.
This method should be running in the background so that you could not catch it in the UI thread. It essentially bypasses any chance dev has at handling the exception.
Our suggestion is that you need to check the network before calling this method and give a tip when calling this method to tell the user to keep network connection. And you could try to subscribe to the NetworkInformation.NetworkStatusChanged Event in your app.

C# .NET - Application startup error after it's installed

I run my program in visual studio and it works great, but when i publish it and installed it dont start. I checked the problem on the event viewer and it's the information that comes with the error:
Faulting application name: Screen recorder.exe, version: 1.0.0.0, time
stamp: 0x59f8f3ad
Faulting module name: KERNELBASE.dll, version: 6.1.7601.23915, time stamp:
0x59b94abb
Exception code: 0xe0434352
Fault offset: 0x0000c54f
Faulting process id: 0x22f8
Faulting application start time: 0x01d35294634fde75
Faulting application path: C:\Users\jmarin\AppData\Local\Apps\2.0\LAHCHL75.EB9\PJ1V31LT.BZW\scre..tion_b46dd58387405837_0001.0000_c9a5ed0df210aa7f\Screen recorder.exe
Faulting module path: C:\Windows\syswow64\KERNELBASE.dll
Report Id: a1aed905-be87-11e7-849a-989096bc2875
Application: Screen recorder.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
at ScreenRecord.Form1..ctor()
at Screen_recorder.Program.Main()
Exception Info: System.IO.FileNotFoundException
Please look into your code, you are using file which is not available while publishing. you can copy the file into the root directory and try it again

VS 2015: How to debug Access Violation from MSVCR120.dll

I am working on a VS 2015 MVC C# web application for a client. The application has been stable for a couple of years, but the client has asked me to integrate some C++ DLLs that perform engineering calculations relevant to our web application.
Unfortunately there is no source code and documentation does not exist (don't ask me why...). So I am somewhat blind to how to use these DLLs.
When I load the main DLL and attempt to use it I get the following error:
Failed to load library SQLite3Ex.dll
Event viewer contains this entry:
Faulting application name: iisexpress.exe, version: 10.0.10557.1000, time stamp: 0x560abee8
Faulting module name: MSVCR120.dll, version: 12.0.21005.1, time stamp: 0x524f7ce6
Exception code: 0xc0000005
Fault offset: 0x0000f20c
Faulting process id: 0x1450
Faulting application start time: 0x01d1c6773bd1167d
Faulting application path: C:\Program Files (x86)\IIS Express\iisexpress.exe
Faulting module path: C:\WINDOWS\SYSTEM32\MSVCR120.dll
Report Id: 5d46a86a-2202-4d6e-af41-8426c16966e9
Faulting package full name:
Faulting package-relative application ID:
I'm not sure how to troubleshoot this problem and was hoping someone could point me in the right direction. I think this is a general error - could be a missing .cfg file or even a missing DLL? But I'm not sure how to determine the problem.

Debug build works fine, Release build breaks?

Trying to publish my UWP app. I'm able to build Release versions fine (I was actually able to push to the Store), but my app crashes as soon as it's launched. But the debug works fine?
I'm getting this error when debugging a Release build:
Unhandled exception at 0x55BA32F9 (Windows.UI.Xaml.dll) in AppName.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x00A12450, 0x00000002).
And these errors in Event Viewer if I launch it outside of VS:
1st:
Activation of app AppName failed with error: The remote procedure call failed. See the Microsoft-Windows-TWinUI/Operational log for additional information.
2nd:
Faulting application name: AppName.exe, version: 1.0.0.0, time stamp: 0x560c53bd
Faulting module name: Windows.UI.Xaml.dll, version: 10.0.10240.16431, time stamp: 0x55c9b90a
Exception code: 0xc000027b
Fault offset: 0x007132f9
Faulting process id: 0x1e38
Faulting application start time: 0x01d0fbcba39fec70
Faulting application path: C:\Development\AppName\AppName\bin\x86\Release\AppX\AppName.exe
Faulting module path: C:\Windows\System32\Windows.UI.Xaml.dll
Report Id: 5c74b39d-98e4-4e89-b2ec-c81cbd5383d1
Faulting package full name: AppName
Faulting package-relative application ID: App
Is there something I'm doing wrong? I don't get any errors or warnings on Debug.
Add some code to the app.xaml.cs files unhandled exception event to send the error text to a web service or something like google analytics so you can see what is happening
Ended up being an issue with Entity Framework when it is compiled in .NET Native. I had to switch to SQLite for what I was using it for. Seems to work fine now.
https://github.com/aspnet/EntityFramework/issues/3293

How to solve stopped windows service 'clr.dll error?

Hi; i have a windows service. i want to start my windows service by a batch file(.bat file). i do it succesfully.
My service is starting very good. But 4-5 seconds later stop itself. Not working 4-5 seconds later.if i look my event logs on my windows server 2008,
an error occured. My error is below. How can i solve this problem?
Faulting application name: MyProject.WindowsService.exe, version: 1.0.0.0, time stamp: 0x4ffec57c
Faulting module name: clr.dll, version: 4.0.30319.269, time stamp: 0x4ee9ae83
Exception code: 0xc00000fd
Fault offset: 0x003565fd
Faulting process id: 0x1bbc
Faulting application start time: 0x01cd60323465e0b0
Faulting application path: C:\MyProject.WindowsService\bin\Debug\MyProject.WindowsService.exe
Faulting module path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Report Id: 742f8164-cc25-11e1-ae08-00155d100687
0xc00000fd indicates a stack overflow.
Are you calling Win32 apis using p/invoke?
Can you add some logging to the application and see how far it gets before faulting
Does it fail when running as an application (not as a service?)

Categories