GitHub user rokmeglicbit closed a discussion: Assembly.GetEntryAssembly() can 
be null

An example code is using
`LogManager.GetRepository(Assembly.GetEntryAssembly());`

however, I get this warning:

> Possible null reference argument for parameter 'repositoryAssembly' in 
> 'ILoggerRepository LogManager.GetRepository(Assembly repositoryAssembly)'.

Is there any other way I could use log4net without a warning?

**Another option is to use the frame**
```
System.Diagnostics.StackFrame frame = new System.Diagnostics.StackFrame(1);
var method = frame.GetMethod();
Type type = method.DeclaringType;
```

but declaringType can also be null.

> Possible null reference argument for parameter 'loggerType' in 'Type 
> loggerType)'.

Any other solution?

GitHub link: https://github.com/apache/logging-log4net/discussions/333

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to