Skip to content

fixed ConfigureHiddenAssemblies not working for .NET Core 2.0#209

Closed
agentschmitt wants to merge 1 commit into
NLog:masterfrom
agentschmitt:master
Closed

fixed ConfigureHiddenAssemblies not working for .NET Core 2.0#209
agentschmitt wants to merge 1 commit into
NLog:masterfrom
agentschmitt:master

Conversation

@agentschmitt
Copy link
Copy Markdown

Fixed ConfigureHiddenAssemblies not working for .NET Core 2.0 Applications.
This solves issue: NLog/NLog#2647

@304NotModified 304NotModified added this to the 1.0.1 milestone Apr 6, 2018
@304NotModified
Copy link
Copy Markdown
Member

Thanks,

Isn't this an issue with the obsoletes?

[Obsolete("Instead use NLog.LogManager.LoadConfiguration()")]
public static LoggingConfiguration ConfigureNLog(this ILoggerFactory loggerFactory, string configFileRelativePath)
{
ConfigureHiddenAssemblies();
return LogManager.LoadConfiguration(configFileRelativePath).Configuration;
}
/// <summary>
/// Apply NLog configuration from config object.
/// </summary>
/// <param name="loggerFactory"></param>
/// <param name="config">New NLog config.</param>
/// <returns>Current configuration for chaining.</returns>
[Obsolete("Instead assign property NLog.LogManager.Configuration")]
public static LoggingConfiguration ConfigureNLog(this ILoggerFactory loggerFactory, LoggingConfiguration config)
{
ConfigureHiddenAssemblies();
LogManager.Configuration = config;
return config;
}

(the method is still not called in .NET core 2?)

@agentschmitt
Copy link
Copy Markdown
Author

The Obsoletes are also not working, cause the code inside of ConfigureHiddenAssemblies() is filtered out with the pre compiler condition (#if NETCORE1_0 && !NET451). So it is missing for NETCORE2_0.

@snakefoot
Copy link
Copy Markdown
Contributor

Have created #210

@agentschmitt
Copy link
Copy Markdown
Author

I think #210 is a more complete solution for the whole Nlog project. So i will close mine 👍

@snakefoot
Copy link
Copy Markdown
Contributor

@agentschmitt Nlog.Extensions.Logging 1.0.1 has now been released. You can test if it works for you

@agentschmitt
Copy link
Copy Markdown
Author

@snakefoot yes thx it is working now for .NET Core Application with HostBuilder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants