Error regarding system.io in .net - c#

my .net service application started crash occasionally. Once investigate in windows event viewer, I get the below message:
Application: myapp.exe Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.IOException at
System.IO.__Error.WinIOError(Int32, System.String) at
System.IO.__Error.WinIOError() at
System.Threading.EventWaitHandle.Set() at
System.IO.FileStreamAsyncResult.AsyncFSCallback(UInt32, UInt32,
System.Threading.NativeOverlapped*) at
System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32,
UInt32, System.Threading.NativeOverlapped*)
From the error message, I'm not sure which part of my source code is giving me this error. Do you guys know what error is this?
And is it that because I didn't put a try/catch block on some of my code that's why it will have this error and crashes my app?

This exception will be thrown when an I/O errors occurs. When process can't read or write correctly. Maybe Its because of your threading,It can't be done correctly.
"And is it that because I didn't put a try/catch block on some of my code that's why it will have this error and crashes my app?" ->
And yes,you see the error because you didn't use any try/catch block.

Related

How to use SignalR as client in windows service? (File not found exception: at Microsoft.AspNet.SignalR.Client.Http.DefaultHttpClient.Initialize)

I'm going to use SignalR in a windows service as client.
Service is running under administrator privileges.
And "Microsoft.AspNet.SignalR.Client" package added by nuget.
running code as windows application has no errors and runs correctly. but when I install it as service, service stops and in windows Events I can see this error.
this answer did not resolved my problem.
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
Exception Info: System.IO.FileNotFoundException
at Microsoft.AspNet.SignalR.Client.Http.DefaultHttpClient.Initialize(Microsoft.AspNet.SignalR.Client.IConnection)
at Microsoft.AspNet.SignalR.Client.Transports.TransportHelper.GetNegotiationResponse(Microsoft.AspNet.SignalR.Client.Http.IHttpClient, Microsoft.AspNet.SignalR.Client.IConnection, System.String)
at Microsoft.AspNet.SignalR.Client.Transports.AutoTransport.GetNegotiateResponse(Microsoft.AspNet.SignalR.Client.IConnection, System.String)
at Microsoft.AspNet.SignalR.Client.Transports.AutoTransport.Negotiate(Microsoft.AspNet.SignalR.Client.IConnection, System.String)
at Microsoft.AspNet.SignalR.Client.Connection.Negotiate(Microsoft.AspNet.SignalR.Client.Transports.IClientTransport)
at Microsoft.AspNet.SignalR.Client.Connection.Start(Microsoft.AspNet.SignalR.Client.Transports.IClientTransport)
at Microsoft.AspNet.SignalR.Client.Connection.Start()
I don't know why, but when I catch error, the error text changes and says System.Net.Http is missing.
And I don't know why it runs perfectly as widows application, but not in service.

Exception in UWP on device and emulator

So, the problem: I have working application on UWP, written on C# and C++. It works as it must work on desktop in releas and debug modes. It worked on mobile devices and emulator not so long before some changes happend in C++ part. But now application crashes at the begining of C++ part if application opens on emulator or mobile. MSVS gives me this messages, but It does't helped:
Exception thrown at 0x7767B928 (ntdll.dll) in rhodes.exe: 0xC0000139: Entry Point Not Found.
Exception thrown: 'System.Runtime.InteropServices.COMException' in System.Private.Interop.dll
The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)
Exception thrown: 'System.Runtime.InteropServices.COMException' in System.Private.Interop.dll
Exception thrown at 0x76EA2812 (KernelBase.dll) in rhodes.exe: 0x40080201: WinRT originate error (parameters: 0x8007007F, 0x00000050, 0x03B0E2DC).
Any ideas?
Go to Debug -> Windows -> Exception, and enable breaking on all exception types (C++, CLR and Win32) ones. Depending on where the issue comes from, you'll need to use either native or managed mode debugging (you can set it in Project Properties -> Debug tab). Now, the project should hit a breakpoint when you hit that exception, which will point you to where it is coming from.

System.Windows.Forms.Application.ProductVersion produces FileNotFoundException

Can anyone explain how System.Windows.Forms.Application.ProductVersion can throw a FileNotFoundException?
Stack trace is
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
Stack:
at System.Diagnostics.FileVersionInfo.GetVersionInfo(System.String)
at System.Windows.Forms.Application.GetAppFileVersionInfo()
at System.Windows.Forms.Application.get_ProductVersion()
The error only affects one user and is inconsistent, but when it occurs, it is when the application is starting up, so the exe must exist for the application to start.
The exe resides on a network share, but there is no evidence of any network or disk errors.
What is also strange is that the program sets up UnHandledException and ThreadException handlers to log all such errors and these routines are not being called.
Any ideas?
There is probably a latency observed in accessing the network share location. You can first check if the file exists at that location and then get the version, to avoid this.

"An unhandled exception of type 'System.ExecutionEngineException' occurred in Unknown Module."

I'm writing an app in metro (XAML + C#) and I have fatal error which source I can't find:
System.ExecutionEngineException was unhandled
Message: An unhandled exception of type 'System.ExecutionEngineException' occurred in Unknown Module.
It came when I push the button and open new frame.
Weird is this that when I run this app on my laptop there is no any error but when i run it on another computer it have this fatal error when i going from one site to another.
Can someone help me? Anyone have some idea what can be wrong?

Task.Factory.StartNew with uncaught Exceptions kills w3wp?

I just transitioned some of my website's code from using QueueUserWorkItem to Task.Factory.StartNew
I have some bad code that threw an Exception and it ultimately shut down w3wp. Running IIS 7.5 on Windows Server 2008 R2, x64
Task.Factory.StartNew(() =>
{
MethodThatThrowsException();
}
Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AggregateException
Stack:
at System.Threading.Tasks.TaskExceptionHolder.Finalize()
Exception: System.AggregateException
Message: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.
StackTrace: at System.Threading.Tasks.TaskExceptionHolder.Finalize()
InnerException: System.Data.SqlClient.SqlException
I would have assumed an exception would have generated an event log and NOT have killed w3wp. Is this a wrong assumption?
Unhandled exceptions crash IIS worker process. This is by design. http://support.microsoft.com/kb/911816
Therefore, you should properly handle exceptions.

Categories

Resources