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

   We have a Windows project that we've set to use PublishAOT
   
   When calling:
   
   ```c#
   LogManager.GetLogger(typeof(SomeType));
   ```
   We get this exception:
   
   ```
      System.PlatformNotSupportedException: Operation is not supported on this 
platform.
      at System.Reflection.Assembly.GetCallingAssembly() + 0x4a
      at log4net.LogManager.GetLogger(Type) + 0xe
   ```
   
   As it happens, GetLogger calls `Assembly.GetCallingAssembly();` which is not 
supported in AOT compiled binaries.
   
   solutions:
   
   I would add Net6.0 / Net8.0 target platforms, and use conditionals to use 
something other than GetCallingAssembly();
   
   Alternatives:
   
   As a temporary replacement we're switching to use 
`GetLogger("SomeRepository", typeof(SomeType));` but it's not ideal, specially 
because if forces us to revisit all the libraries we have using log4net.
   


-- 
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: notifications-unsubscr...@logging.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to