Skip to content

Exception calling GetLogger when compiled using PublishAOT #233

Description

@vpenades

We have a Windows project that we've set to use PublishAOT

When calling:

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();

Also, I've seen #142 and #143 , unfortunately PublishAOT requires Trimming to be set and it cannot be opted out.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions