Hello,
I'm creating a windows service to perform a backup job. I have created other services before but never had a similar problem.
It was all going well, during the development I installed the service on a computer and was running it normally to make the tests and adjustments, just before finishing the work the service stopped running, whenever it started it showed the following message in eventvwr:
Application: Backup67.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.TypeInitializationException Stack: at WinService.WinService.Main ()
And right after this:
Faulting application name: Backup67.exe, version: 0.0.0.0,
time stamp: 0x552c2561
Faulting module name: KERNELBASE.dll, version: 6.1.7601.18229,
time stamp: 0x51fb1116 Exception code: 0xe0434352
Fault offset: 0x0000c41f
Faulting process id: 0x2bec
Faulting application start time: 0x01d07627884c559e
Faulting application path: C: \ Backup67.exe
Faulting module path: C: \ Windows \ syswow64 \ KERNELBASE.dll
Report Id: c5fb41de-e21a-11e4-a82f-001e67aaf90c
I found it strange and tried to execute the process on my machine through f5 of visual studio, the same error appeared:
An unhandled exception of type 'System.TypeInitializationException' occurred in Unknown Module.Additional information: The type initializer of 'WinService.WinService' thrown an exception.
I've been trying to debug, but I can not because apparently the system does not even run the service, it's stopped before I can get into any breakpoint or Catch I can put. I've tried using the AppDomain for the UnhandledExceptions but also unsuccessfully.
I've been looking for a solution ever since, I tried to change the framework, change the CPU type, but none of that worked. What I'm finding strange is that the program was running until just before the error, perfectly, there was no change in the system, just changed the name of a variable and this error appeared.
Whoever can help will be grateful. Att,