Reputation: 543
I just opened up the source code for a console application that was deployed a couple years ago to run twice a day as a windows scheduled task on our server (it updates something in the database). When it was deployed was running just fine, but now we need to make some code changes. I try to run it in Debug and the program won't even enter sub main. It hits the line
static void Main(string[] args) and just ends running. The console window disappears. I haven't heard from the clients that the production version isn't running, but when I check their servers I don't see the Event Log entries that I should (the app is supposed to write to the Event Log each time it runs)
Upvotes: 0
Views: 578
Reputation: 3468
I have also seen this occur if you don't have the correct version of .NET framework on the machine you're running the application on. Perhaps you changed the target framework version when you recompiled it.
Upvotes: 1
Reputation: 888263
This is probably a DLL issue.
If Main()
uses types from an assembly that the JITter can't find, the program will die before hitting Main()
.
This would also happen if the type containing Main()
has fields of a type that couldn't be loaded.
It could also happen if that type's static constructor calls Environment.FailFast()
.
Upvotes: 4