Click here to Skip to main content
15,889,266 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I've created a CLR (Class Library) project on Visual Studio 2017 to get a DLL for C++ code to be used by several windows services visual studio 2017 projects developed on C#. The developed windows services work fine on the development PC but they don't work in the customer PCs.

The services finished immediately and you can track the error below on the windows event manager.

Application: PcAmpel.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException at Code.Anwendung() at System.Threading.ThreadHelper.ThreadStart_Context(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Threading.ThreadHelper.ThreadStart()

I've found on the web about similar problems, but either the information is too poorly explained or wrong or the link fixes being provided by Microsoft have been removed.

A good advice would be very much appreciated.

Best, Marcos

What I have tried:

I've tried installing every .NET Framework and any distributable Visual Studio packages, but nothing helped, I've found, that after installing Visual Studio 2017 on the customer PC, every windows service can be started and works fine, but this is not a solution. I've contacted Microsoft virtual chat and scheduled two phone calls at different days but their help is a joke and waste of time. You are being passed from one employee to other and at the end, the phone call is off.
Posted
Updated 3-Jul-18 12:58pm

1 solution

You're looking at everything except your own code.

The error message makes in plainly obvious, "File Not Found".

You're code tried to open a file or similar and the file specified doesn't exist where you said it was going to be.

You also did not anticipate this situation and didn't wrap any of the code in a try/catch block to catch this possibility and log the exception and any useful details anywhere, like the file path you tried to access.
 
Share this answer
 
Comments
Member 10836832 4-Jul-18 3:31am    
Thanks for your reply, but your answer doesn't help.

It seems like the loading software of unmanaged DLL by Msoft uses a directive which isn't found by them, but this is fixed after installing the Visual Studio Software.
Dave Kreskowiak 4-Jul-18 10:24am    
OK, so there's about a million different ways to get this error and we know nothing about your code at all. SO, any answers you get are just guesses.

Next guess. You didn't put the .DLL you're loading into the same folder as your C# executable.
Member 10836832 5-Jul-18 3:06am    
nop, otherwise they wouldn't run after installing visual studio 2017 on the customer PCs.
Dave Kreskowiak 5-Jul-18 7:56am    
You're not helping at all. Considering there's about a thousand different reasons you can get this error, and we know precisely NOTHING about your code, the circumstances under which the exception is thrown, anything about this .DLL you're using, it's code, ..., there is NOTHING anyone can say that's going to pinpoint what the problem is.
Richard Deeming 5-Jul-18 11:47am    
Down-vote from thankless work-shy help vampire countered.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900