Why default generic host adds EventLogLogger (Windows-only) when targeting net8.0 (not net8.0-windows)? #121171
-
|
Both What is the use for default generic host to add logger provider that throws exceptions? Why not to add it only for |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
|
OS-specific target framework is not commonly used. Most service applications are built with OS-neutral framework. That's why
Is the correct version of Microsoft.Extensions.Hosting.dll copied to the folder at all? |
Beta Was this translation helpful? Give feedback.
-
|
It only adds the event logger on windows |
Beta Was this translation helpful? Give feedback.

In other words, it's totally unrelated to whatever you are doing in high level callers, including your plugin, or the Microsoft.Extensions.* libraries.
The fundamentally wrong thing is that you are loading
lib\netstandard2.0version ofSystem.Diagnostics.EventLoginto a Windows process. It's a throw-only version. You should useruntimes\win\lib\net8.0version for anet8.0process, andlib\net462version for a .NET Framework process. The two versions are not compatible.