I have a .NET Core 6.0 self-contained application (not a single file deploy).
My app.runtimeconfig.json configuration file contains this setting:
"runtimeOptions": {
"additionalProbingPaths": [
"lib",
"Lib"
],
It's because I want to redirect the dll probing to a subfolder to avoid the mess a self-contained application generates on its root.
This way my root contains only these files:
- app.exe
- app.dll
- app.runtimeconfig.json
- app.deps.json
- hostfxr.dll
- hostpolicy.dll
All the runtime dependencies are inside 'lib' folder.
With this configuration the application works perfectly in every scenario with a very relevant exception: if I start it during the Windows startup, it fails.
I think it's not important for the purposes of the bug description but I start the program with a registry entry in HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run.
I enabled the .NET tracing and compared a trace of a successfull start (double click on the executable) and a trace of an unsuccessfull one (auto start with the registry key).
These are the outcomes:
Successful start with double click:
Runtime config [D:\App\App.runtimeconfig.json] is valid=[1]
Executing as a self-contained app as per config file [D:\App\App.runtimeconfig.json]
Unsuccessful start with autorun:
Runtime config [D:\App\App.runtimeconfig.json] is valid=[1]
Ignoring additional probing path lib as it does not exist.
Executing as a self-contained app as per config file [D:\App\App.runtimeconfig.json]
As you can see if the application runs during the Windows startup, the runtime is not able to find the additional probing path.
The two trace files are identical until this point, then, the lacking of an additional probing path, is causing all the runtime dll files are not found during the failed attempt.
Tested on Windows 10 (x64)