Stopped with Exit Code = '-1073740791'. How can I debug it? - c#

I have a Windows service that is started and after some time it shuts down with the following exit code:
-1073740791. STATUS_STACK_BUFFER_OVERRUN.
How can I debug? How do I know what is happening. Tried attaching with the debugger (with "Enable native code debugging" enabled) and selected all exceptions but it doesn't stop. The service just exits.

Related

OpenCvSharp Access Violation

I am using OpenCvSharp4 4.1.0.20190416 and function for deep neural networks.
...
mDnn.SetInput(blob, "data");
// get output layer name
var outNames = mDnn.GetUnconnectedOutLayersNames();
// create mats for output layer
Mat[] outs = outNames.Select(_ => new Mat()).ToArray();
// Run dnn
mDnn.Forward(outs, outNames);
...
When during debugging step over the mDnn.Forward row, after while application crashed with access violation. But calling mDnn.Forward returns results without any problem. I don't have any idea, where could be problem.
Program Trace' has exited with code 0 (0x0).
has exited with code -1073741819 (0xc0000005) 'Access violation'.
Ok, I have found solution. It seems that everything can be solved by enabling
"Enable native code debugging" property in project properties at debug tab.
UPDATE
After enabling this property, application crash on different error.
Finally the problem was in Intel Graphic driver version:24
I have to uninstall the driver and everything is ok.
Uninstallation process

Application stops running after some time

I have built a web app which suddenly stops while running. I could see the following in output window in my VS
The program '[29000] iisexpress.exe: Managed (v4.0.30319)' has exited with code -1073741819 (0xc0000005) 'Access Violation'
The program '[20648] iexplore.exe' has exited with code -1 (0xffffffff).
I have tried to debug to find the line where it fails. But it did not fail anywhere. The page was successfully loaded and it stops running after few seconds.
Check out the answers for this question.
You can try cleaning the solution/project and making sure you delete ASP.NET temporary files.
I noticed your error includes detail regarding IExplore.exe; makes me wonder if the debug process is unable to launch Internet Explorer due to something blocking that invocation. Try temporarily turning off Windows Firewall or any Anti-Virus program and make sure User Account Control (or LUA if on Windows Server) is disabled.

Windows Phone - Debug info lines cause the program to malfunction

Hi I'm developing a windows phone app and I use
System.Diagnostics.Debug.WriteLine()
function to write some debug info and when I run the program in debug mode while my phone is connected to my computer and visual studio there is no problem. but when I run the program without debugger - while installed in each of release and debug mode - those lines of debug info cause the app to encounter an exception!
can anybody explain what's going in there?
You can try to check if debugger is attached, then execute codes specific for debugging purpose only if IsAttached value is true :
if(System.Diagnostics.Debugger.IsAttached)
{
System.Diagnostics.Debug.WriteLine();
}

How to debug the installation of a custom Windows service?

I created a Windows service in C# (4.0) and am trying to install it using installutil tool in command line. However I get an exception. I managed to find out what part of my code is causing the exception - using some crappy logging but whatever - but now I want to understand why. So what I want to do is debugging the installation of my Windows Service.
I know how to debug the service itself, but here, I want to debug the content of my Installer.Install(IDictionary stateSaver) method in the service.
I tried to attach the debugger to the cmd.exe process but it obviously doesn't work. I was thinking also to attach the debugger to the installutil process but I have no clue how to do this.
I had a look to this post: How do you debug a windows service that is being installed? and several others but in this case, for some reason, this guy seem to have his service already in the services.msc which is not my case.
How can I achieve this?
You can put a Debugger.Break(); statement in the installer code, and it should launch the debugger for you.
If the above does not work, I have found this process works too. Basically, you compile in debug mode and install the service (I used installutil.exe through the command line). In code you pop-up a message box with the process ID. Startup a second instance of studio, attach it to that process and debug. The message box pauses it to allow setup. The process ID isn't important, its named InstallUtil.exe. I usually put a Debug.Break() in after the message box to guarantee it enters the code.
using System.Windows.Forms;
using System.Diagnostics;
...
#if DEBUG
int processId = Process.GetCurrentProcess().Id;
string message = string.Format("Please attach the debugger (elevated on Vista or Win 7) to process [{0}].", processId);
MessageBox.Show(message, "Debug");
#endif
....
How to debug the installation of a custom windows service

Loading sandbox AppDomain crashes debugger

I am creating a sandbox AppDomain so I can load up an assembly and release it.
var sandbox = AppDomain.CreateDomain("Sandbox", null,
AppDomain.CurrentDomain.SetupInformation);
However when I Load an assembly into to sandbox, the debugger crashes. I am in ASP.NET.
var assemblyName = AssemblyName.GetAssemblyName(assemblyPath);
var assembly = pluginDomain.Load(assemblyName); // crash here
Anyone know why this crashes?
Can you elaborate on what you mean by "Debugger Crashes". Does Visual Studio itself crash, does the debugger just stop and returns to Visual Studio design mode, does an exception dialog popup, etc ...
For all of these cases though the first thing I would do would be to change the following debugger options and repeat the scenario.
- Tools -> Options -> Debugger
- Uncheck: Enable implicit property evaluation
- Uncheck: Enable Just My Code
I had a similar issue: Only when debugging, my program quit without any exception when accessing AppDomain. After looking in the event viewer, I saw that Microsoft.IntelliTrace.Profiler caused application errors.
The solution was disabling intellitrace:
Uncheck: Tools -> Options -> intelliTrace -> Enable intelliTrace

Categories