locked
System.IO.FileNotFoundException' in System.Private.CoreLib.dll RRS feed

  • Question

  • User948188685 posted

    I have a .NET Core 3.1 Windows(Worker) Service with an assembly reference to a .NET Standard 2.1 Class Library .  (2 separate solutions each with their own project. In a nutshell, I have a windows service project calling another compiled DLL to gain additional functionality (call happens every 60 seconds).

    When the Worker Service makes a call to methods in the DLL everything is fine until the DLL tries to create an instance of:

    System.Configuration.RegexStringValidator IsValidString = new RegexStringValidator(@"[Some Regular Expression Here]");

    As soon as this line is encountered, the debug window of the Worker Service states:

    Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.dll

    All ability to step through and debug both projects stop if the DLL even contains this line of code. Neither putting try/catch blocks around RegexStringValidator statement in the DLL nor calling line of code worker service allow the debugger to continue stepping through the two programs.  The windows service timer keeps running but all breakpoints and debugger no longer work for the current iteration

    The latest Microsoft.Configuration libraries have been installed into both project with NuGet.  Some sites says this error is a false positive. That is loaded as part of the default of any project using .NET Core/Standard and is handed even though the output window reports the error.  However, because the debugger wont step out of the DLL and allow the Worker process to report more info on the error, Im at a lost of what do to.

    I even installed Microsoft.NETCore.Runtime.CoreCLR hoping it might fix the issue.  It did not

    I know what the error should mean, but not sure why OR how to fix it. Im at my wits end

    Help is greatly appreciated.

    Sunday, August 16, 2020 10:43 PM

All replies

  • User-782232518 posted

    How did you deploy the binaries? Self contained deployment as a single file?

    Monday, August 17, 2020 1:47 AM
  • User948188685 posted

    Single File. Both projects have their own NuGet package installers.   Everything is  running on my localhost as I am still debugging the class library project.  In order to debug I created a COM Reference in the Worker Service to point to the DLL in the bin folder of the class library. There is only a single DLL in the bin/debug folder.

    Are you suggesting to run both projects out of the same solution?

    Monday, August 17, 2020 11:03 AM
  • User-782232518 posted

    Single File. 

    I am referring to this single file flag, https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#single-file-executables which is often the cause of such exceptions, but I didn't know the exact causes. Not sure what you meant by "Single File".

    Tuesday, August 18, 2020 10:13 PM