I have a Windows service written in C#/.NET, compiled to AnyCPU, that dies on startup apparently while trying to initialize StructureMap. I’ve used Debug Diagnostics v1.2 to get the following stacktrace out of the memory dump:
System.RuntimeTypeHandle.CreateInstance(System.RuntimeType, Boolean, Boolean, Boolean ByRef, System.RuntimeMethodHandleInternal ByRef, Boolean ByRef)
System.RuntimeType.CreateInstanceSlow(Boolean, Boolean, Boolean)Unable to load image C:\Windows\assembly\NativeImages_v4.0.30319_64\mscorlib\b10e2a4a87b27f241113ead9433e25da\mscorlib.ni.dll, Win32 error 0n2
System.RuntimeType.CreateInstanceDefaultCtor(Boolean, Boolean, Boolean, Boolean)
System.Activator.CreateInstance[[System.__Canon, mscorlib]]()
StructureMap.ConfigurationExpression.AddRegistry[[System.__Canon, mscorlib]]()*** ERROR: Module load completed but symbols could not be loaded for StructureMap.dll
StructureMap.ObjectFactory.Initialize(System.Action`1)
The second line is actually the one of interest to me. That file is present on my machine. Where should I look next for how to debug this service and get it running?
For what it’s worth, I’ve got a unit test that validates that the StructureMap configuration is correct, and it successfully passes.
Win32 error 0x2 is “file not found”. Use Fuslogvw.exe to collect fusion errors. From fusion logs youd should be able to figure out which assembly is not found and where the loader searched for it before it gave up. Remember that windows service always starts in System32 directory…
(copied Seva Titov’s comment)