C# console app crashes when called using shortcut - c#

I have a small C# console application that copy to a server, where it runs just fine.
However, if I call the .exe using a shortcut from another machine, it crashes. Any dependencies are also present on the calling machine.
In the eventview on the calling machine, all I'm getting is:
Faulting module name:
KERNELBASE.dll, version: 6.2.14393.2189, time stamp: 0x5abdad60
Exception code: 0xe0434f4d
Any ideas to help?

The returned exception is an error with permissions - see the following MSDN forum post;
https://social.msdn.microsoft.com...
It surmises that by default .NET security does not allow you to run .NET programs directly from a network share. The error itself is from a COM object - "Exception from COM object".

Related

C# compiled .exe System.IO.FileNotFOundException

(Environment = Windows 10 1803, program type is .exe)
I have written a program to be used across different computers at work, however, When i try to run the compile program from anyone elses machine other than my own (and my fellow IT coworkers), I end up with this error:
(From event viewer)
Event 1026, .NET Runtime Application: program123.exe Framework Version
v4.0.30.319 Description: The process was terminated due to an
unhandled exception. Exception Info: System.IO.FileNotFoundException
at
System.Reflection.RuntimeAssembly._nLoad(System.Reflection.AssemblyName,
System.String, System.Security.Policy.Evidence,
System.Reflection.RuntimeAssembly, ........
I have extensive logging in the application and pretty much log immediately upon program entry. However, my log never gets hit - (to me, this means that this application is being blocked, or dying before running any code).
This is different because my application does not even start. In the example that you recommended, the application begins and then fails on an event. My .exe will not work at all.
Any help would be appreciated. Thanks in advance.

Winforms CL20R3 with CefSharp Project

I have a similar problem to this question C# windows appication Event: CLR20r3 on application start
The error is like this:
Application: MantenedorPlanesMain.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
Battery:
in CefSharp.Example.CefExample.Init ()
in CefSharp.WinForms.Example.Program.Main ()
But only on some machines, for example, on my computer I can use the program without any problem and in a computer of my office too.
I tried to find the source of the problem here in stackoverflow and realized that the error was caused by a cs file not found, but is within the project.
When I go to see CefSharp.WinForms.Example.Program.cs and comment the line of CefSharp.Example.CefExample.Init() throws me the same error in another file.
I tried everything, even the CopyLocal = true and x86, but still not working. I think there may be a problem with the system language, which is the only common factor of the machines that worked, Spanish language system.
any ideas?
In this context FileNotFoundException usually means you need to install VC++ or that you compiled in Debug mode (You need to build in Release mode when running on a machine without VS installed)
https://github.com/cefsharp/CefSharp/blob/master/NuGet/Readme.txt#L18
Also See the Note within https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions#6-how-do-i-include-the-visual-studio-c-2012-redistributables-on-the-target-app

.Net 4.0 crashes in clr.dll on Windows Server 2008 x86

We have a Windows Application that runs day in day out at several locations. Now though they've started crashing, they don't even generate an error on crash (should be catched by NLOG), they just stop suddenly. The only logs of the crash I can find is in the system event logger where I get 2 error logs:
Faulting application myapp.exe, version 1.0.0.0, time stamp 0x53f3377c, faulting module clr.dll, version 4.0.30319.2034, time stamp 0x52ccfa2b, exception code 0xc0000005, fault offset 0x0000ee9f, process id 0x%9, application start time 0x%10.
and
The process was terminated due to an internal error in the .NET Runtime at IP 6D09EE9F (6D090000) with exit code 80131506.
These are the descriptions in the event viewer (I can post the entire event log if it would help).
I hope someone knows how to get rid of these (I'm sick of getting calls in the night).

Problems publishing working application to Azure

I have an MVC 5 build that is building and running locally without any problems whatsoever. I cannot however publish to Azure. I'm publishing with Intellitrace enabled and I'm seeing that an exception is being thrown attempting to activate the role.
Exception Thrown: "Requested registry access is not allowed." (System.Security.SecurityException)
I have made sure of the following:
I have the latest edition of the Microsoft Azure SDK
All the relevant project references for all of my project references are set to Copy Local: True
All the relevant libraries have the correct binding redirects in their respective app.config/web.config files
All the Azure references in my project are to the correct versions of the assemblies
The event log shows the following exceptions in chronological order:
Error 4/11/2014 3:23:57 AM SRMSVC 8228 None
File Server Resource: Manager was unable to access the following
file or volume: 'E:'. This file or volume might be locked by
another application right now, or you might need to give Local
System access to it.
Error 4/11/2014 3:31:44 AM .NET Runtime 1026 None
Application:
DiagnosticsAgent.exe Framework Version: v4.0.30319 Description: The
process was terminated due to an unhandled exception. Exception Info:
System.IO.FileNotFoundException Stack: at
Microsoft.WindowsAzure.Plugins.Diagnostics.DiagnosticsGuidNamedEventProvider.GetNamedEvent(System.String)
at
Microsoft.WindowsAzure.Plugins.Common.BlockingExecutionEnvironment.Execute(System.Func`1)
at
Microsoft.WindowsAzure.Plugins.Diagnostics.Program.Main(System.String[])
Error 4/11/2014 3:31:44 AM .NET Runtime 1026 None
Application:
DiagnosticsAgent.exe Framework Version: v4.0.30319 Description: The
process was terminated due to an unhandled exception. Exception Info:
System.IO.FileNotFoundException Stack: at
Microsoft.WindowsAzure.Plugins.Diagnostics.DiagnosticsGuidNamedEventProvider.GetNamedEvent(System.String)
at
Microsoft.WindowsAzure.Plugins.Common.BlockingExecutionEnvironment.Execute(System.Func`1)
at
Microsoft.WindowsAzure.Plugins.Diagnostics.Program.Main(System.String[])
.
Error 4/11/2014 3:31:45 AM Application Error 1000 (100) Faulting
application name: DiagnosticsAgent.exe, version: 0.0.0.0, time stamp:
0x5243ef34 Faulting module name: KERNELBASE.dll, version:
6.2.9200.16451, time stamp: 0x50988aa6 Exception code: 0xe0434352 Fault offset: 0x000000000003811c Faulting process id: 0x9c Faulting
application start time: 0x01cf55368ce74b73 Faulting application path:
E:\plugins\Diagnostics\DiagnosticsAgent.exe Faulting module path:
D:\Windows\system32\KERNELBASE.dll Report Id:
cdd18167-c129-11e3-93f5-00155d85a04e Faulting package full name:
Faulting package-relative application ID:Server ResourceApplication:
We were getting the following error:
"File Server Resource Manager was unable to access the following file or volume: 'E:'. This file or volume might be locked by another application right now, or you might need to give Local System access to it."
We resolved the issue by updating our project references. If you are getting this error, check your Azure references, specifically these two:
Microsoft.WindowsAzure.ServiceRuntime
Microsoft.WindowsAzure.Diagnostics
Ensure that your references are the appropriate Azure SDK version to the schema/SDK you are pointing to in Azure.

How to catch an untrapped exception? Windows 7

my program is working in Windows XP, but crashes without any exception in windows 7. Try catch does not work. I also tried application.unhandledexception with no luck. Then I tried checking in windows administration and got the following log:
Level Date and Time Source Event ID Task Category
Error 7/25/2011 11:25:14 AM Application Error 1000 (100) "Faulting application name: myApp.exe, version: 1.0.0.0, time stamp: 0x4e2ce191
Faulting module name: ntdll.dll, version: 6.1.7601.17514, time stamp: 0x4ce7b96e
Exception code: 0xc0000005
Fault offset: 0x00052ca9
Faulting process id: 0x%9
Faulting application start time: 0x%10
Faulting application path: %11
Faulting module path: %12
Report Id: %13"
I'm not sure which part of the code to show as it has large collection classes, but I'll get back to editing this post.
I tried dumping files too from task manager, but I'm not sure how to use them.
Are there any particular tools I could use? I'm using VS2008. I looked into NLog, but I'm not sure what to do with it, so I skipped.
Any suggestions? tips and tricks?
Try ThreadExceptionEventHandler and see.
Application.ThreadException += new ThreadExceptionEventHandler(MyCommonExceptionHandlingMethod)
private static void MyCommonExceptionHandlingMethod(object sender, ThreadExceptionEventArgs t)
{
//Exception handling...
}
Edit : In Windows Forms applications, when an exception is thrown anywhere in the application (on the main thread or during asynchronous calls), you can catch it by registering for the ThreadException event on the Application.
EDIT 2
Try with compatibility? If it works fine, then there is something that doesn't compatible with Win7.
You can choose to run the program in Windows XP compatibility mode
Faulting module name: ntdll.dll says you're in for a lot of fun, but you should start with any P/Invokes in your code. It shouldn't be possible to cause such an error from .NET, so it's some native DLL you're calling.
P/Invoke lets you call normal, native, non-managed executables from managed code. This can be anything that isn't programmed in .NET - i.e. drawing libraries, audio libraries, etc. It is possible that you use it without knowing, for example, if you have multimedia controls. There's a pretty decent article right here.
If you're doing COM Interop with i.e. Microsoft Office, the same as above applies. Check if it's the same Office version, and even if it is, you may need the same versions of the Primary Interop Assemblies from Microsoft.
You may also try starting the application from Visual Studio, you might get a stack trace, which tells you the exact path the application took before crashing. Then you'll know what's happening.

Categories