My goal was write a simple C# service and install it on my local machine. Installing worked fine. However, starting the service failed with this event with .NET Runtime as the source.
Application: MyService.dll Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: exception code e0434352, exception address 00007FFC979DCD29 Stack:
There was another event in the log with a source of “Application Error” but it did not provide me any further information. It provided the name and path to my installed service – I already knew that.
There was not a ton of help on the web since “e0434352” is a pretty generic error. Time to pull out “fuslogvw.exe”.
Assembly Binding Log Viewer – fuslogvw.exe
This utility shows information from .NET assemblies as they walk through different paths to resolve assembly reference locations. It’s actually quite fascinating to see all the locations it goes to as it searches. If my service is failing because it can’t find a dependency, this is one way to find out what is going on. It is usually installed along with .NET Framework versions.
- Open a command prompt as admin.
- Run “fuslogvw.exe”. (It’s possible you may need to navigate to where it is.)
- Click “Settings…” then click “Log bind failures to disk”. then click “OK” to exit.
- Click “Delete All” if necessary to throw away any old information.
- Start the service/EXE/DLL you are trying to debug and wait for it to die.
- Go back to “fuslogvw” window and click “Refresh”. You have to refresh the screen each time to get new information.
- If an assembly binding error was detected, it will appear in the dialog window.
- Double click your application and all the details will be displayed in a browser window. In fact, the browser tab label with be the missing DLL.
The Conclusion
Examining the log showed the DLL that the service could not find. It turned out that one of the DLLs that I was referencing had a reference to “System.Runtime.dll” and I did not have that in the folder. I had to repeat the process a couple of times (steps 6 through 10) to determine all the missing assembly references.