tmoonlight opened a new issue, #165:
URL: https://github.com/apache/logging-log4net/issues/165

   Hi,
   
   I am using log4net in my project running on .NET 8. When I enable the 
“PublishTrimmed” setting in my project file 
(<PublishTrimmed>true</PublishTrimmed>), I consistently receive the following 
errors during the configuration of log4net:
   
   
   ```
   
   Starting up as a console service host
   Service NSPServer started
   The NSPServer service is now running, press Control+C to exit.
   Another instance of the program is running. It may cause fatal error.
   Initializing..
   log4net:ERROR Exception while reading ConfigurationSettings. Check your 
.config file is well formed XML.
   System.Configuration.ConfigurationErrorsException: Configuration system 
failed to initialize
    ---> System.MissingMethodException: Cannot dynamically create an instance 
of type 'System.Configuration.ClientConfigurationHost'. Reason: No 
parameterless constructor defined.
      at System.RuntimeType.ActivatorCache..ctor(RuntimeType)
      at System.RuntimeType.CreateInstanceDefaultCtor(Boolean, Boolean)
      at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean 
wrapExceptions)
      at System.Activator.CreateInstance(Type type, Boolean nonPublic)
      at System.Configuration.TypeUtil.CreateInstance(Type)
      at 
System.Configuration.Internal.ConfigSystem.System.Configuration.Internal.IConfigSystem.Init(Type,
 Object[] )
      at System.Configuration.ClientConfigurationSystem..ctor()
      at System.Configuration.ConfigurationManager.EnsureConfigurationSystem()
      --- End of inner exception stack trace ---
      at System.Configuration.ConfigurationManager.PrepareConfigSystem()
      at System.Configuration.ConfigurationManager.GetSection(String)
      at System.Configuration.ConfigurationManager.get_AppSettings()
      at log4net.Util.SystemInfo.GetAppSetting(String)
   ``` 
   
   This issue persists even when I configure log4net purely through code, 
without using a log4net.config file. The problem does not occur in non-trimmed 
mode or older versions of the trimming mode (such as .NET Core 3.0).
   
   To assist in diagnosing this issue, I have attached a file containing my 
program that can reliably reproduce the problem:
   
https://github.com/tmoonlight/NSmartProxy/releases/download/v1.4.0/nspclient_scd_win_x86_v1.4.0.zip
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to