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.
Related
I have a Windows Console application that accesses our SQL database. This app works fine from VS2019, the debug folder and the release folder. However, if I publish this app, the installed version fails with the exception shown below.
I do note the following differences between the installed location (\AppData\Local\2.0\xxx\yyy) and the \Release folder:
The \Release folder has SNI files in the \x86 and \64 directories, but the installed directory is missing this information. How do I include this in the manifest? I suspect that this is the main issue causing the exception.
The manifest file in the installed location is missing information related to Identity - not sure if this is a concern, but perhaps it is?
Application: SmartRView Configuration.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ComponentModel.Win32Exception
at Microsoft.Data.SqlClient.SNINativeMethodWrapper..cctor()
Exception Info: System.TypeInitializationException
at Microsoft.Data.SqlClient.SNINativeMethodWrapper.SNIInitialize()
at Microsoft.Data.SqlClient.SNILoadHandle..ctor()
at Microsoft.Data.SqlClient.SNILoadHandle..cctor()
Exception Info: System.TypeInitializationException
at Microsoft.Data.SqlClient.TdsParser..cctor()
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.
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.
I have an application hosted in iis. Very occasionally (every month or two) the following exception is thrown:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for "System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory" threw an exception. ---> System.MissingFieldException: Field not found: ?.s_webServicesFactoryType.
The application is set to automatically recycle every day and it seems sometimes after a recycle this exception is thrown repeatedly until the next recycle.
The only hit I can find on google is http://mcfunley.com/135/bizarro-typeinitializationexception-in-systemruntimeremoting, which describes the exact same problem but there doesn't seem to be a solution posted.
Has anyone experienced this before?
Thanks in advance.
We have over 1000 unit tests. A while ago 18 of them started to fail when they were run together with the other tests. These tests run a windows workflow.
If they are run alone they pass.
The error appears to be that it cannot find the connection string.
It cannot find the connection string because it does not know which config file to look in.
It does not know which config file to look in because it cannot find the application context
And it cannot find the application context due to a compilation lock.
Anybody have any idea what could be wrong, and how to fix this? The error I am getting is:
Message: Exception message: The
supplied connection string is not
valid, because it contains
insufficient mapping or metadata
information. Parameter name:
connectionString Inner exception :
System.InvalidOperationException:
Unable to determine application
context. The ASP.NET application path
could not be resolved. --->
System.Reflection.TargetInvocationException:
Exception has been thrown by the
target of an invocation. --->
System.Web.HttpException: The type
initializer for
'System.Web.Compilation.CompilationLock'
threw an exception. --->
System.TypeInitializationException:
The type initializer for
'System.Web.Compilation.CompilationLock'
threw an exception. --->
System.NullReferenceException: Object
reference not set to an instance of an
object. at
System.Web.Compilation.CompilationLock..cctor()
--- End of inner exception stack trace --- at System.Web.Compilation.CompilationLock.GetLock(Boolean&
gotLock) at
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
Thanks
Shiraz
Since you mention that your tests run a WF workflow, I would guess that a previous test run has one or more workflow instances that still run on a thread somewhere, thus locking the compiler because the assemblies are still loaded in a process somewhere.
Can you open Task Manager and investigate whether there's a running process that still uses the workflow somewhere? If so, kill it and see if you can't compile.