Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET Core - Improve auto loading of NLog extension dlls #2431

Merged
merged 1 commit into from
Dec 1, 2017

Conversation

snakefoot
Copy link
Contributor

@snakefoot snakefoot commented Nov 28, 2017

NetCore-Console-Applications will usual be compiled to a dll, that is run by the dotnet-tool.

The NLog-package-reference will be loaded from an isolated path, and using this path to load NLog-extension-dlls will result in empty result.

Added extra fallback locations when the NLog-assembly-path returns empty file-list:

  • Assembly.GetEntryAssembly() - Works for NetCore-Console-Application, but will be null for other cases (High probability this will be the private assembly path)
  • AppDomain.BaseDirectory - Should also work for AspNetCore.

But it will not help with dlls coming from Nuget-packages. So maybe it is better to implement something using DependencyContext api to resolve the DLLs and their locations that are part of the application's dependency graph.

@codecov
Copy link

codecov bot commented Nov 28, 2017

Codecov Report

Merging #2431 into master will decrease coverage by <1%.
The diff coverage is 37%.

@@           Coverage Diff           @@
##           master   #2431    +/-   ##
=======================================
- Coverage      82%     81%   -<1%     
=======================================
  Files         322     322            
  Lines       23046   23111    +65     
  Branches     2852    2862    +10     
=======================================
+ Hits        18817   18831    +14     
- Misses       3494    3544    +50     
- Partials      735     736     +1

@304NotModified
Copy link
Member

But it will not help with dlls coming from Nuget-packages.

So it work only for projects in your solution isn't?

@snakefoot
Copy link
Contributor Author

snakefoot commented Nov 29, 2017 via email

@304NotModified
Copy link
Member

small step forward is step forward :)

I think it's nice, maybe a bit more difficult to explain when it works and when don't

@304NotModified 304NotModified added this to the 4.5 rc2 milestone Dec 1, 2017
@304NotModified 304NotModified merged commit 46d55f4 into NLog:master Dec 1, 2017
@304NotModified 304NotModified changed the title NetCoreApp - Improve auto loading of NLog extension dlls .NET Core - Improve auto loading of NLog extension dlls Dec 3, 2017
@snakefoot snakefoot deleted the NetCoreExtensionAutoLoad branch December 4, 2017 19:47
@snakefoot snakefoot modified the milestones: 4.5 rc2, 4.5 Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement on existing feature feature nlog-configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants