-
Notifications
You must be signed in to change notification settings - Fork 129
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
Make sure that single-file apps can find assemblies that contains sinks #353
Make sure that single-file apps can find assemblies that contains sinks #353
Conversation
Oops, I forgot about .NET Framework. 😁 I still have some work to do... |
561e41e
to
0a2672a
Compare
is it not possible to add a test for this sceanrio? |
Yeah absolutely. This will probably require an integration test though, compiling and running some test app. I'll probably use CliWrap to run |
sounds good to me |
...erilog.Settings.Configuration/Settings/Configuration/Assemblies/DllScanningAssemblyFinder.cs
Outdated
Show resolved
Hide resolved
src/Serilog.Settings.Configuration/Settings/Configuration/ConfigurationReader.cs
Outdated
Show resolved
Hide resolved
488787a
to
c48a4a2
Compare
cad4f87
to
a7baebf
Compare
src/Serilog.Settings.Configuration/Settings/Configuration/Assemblies/AutoAssemblyFinder.cs
Outdated
Show resolved
Hide resolved
a7baebf
to
431413a
Compare
I have now added the integration tests. 👍 The upside is that it uncovered issues in the implementation that I did not catch with manual testing. It also allowed me to greatly improve my initial implementation. 👎 The downside is that running the tests went from less than 2 seconds to, well, much more than 2 seconds now that compiling an app and running it is involved. |
List candidate methods only if there are any. Discovered this weird log while working on serilog#353: > Unable to find a method called WithThreadName. Candidate methods are:
Happy to merge this one when you are; I don't think test execution time is a huge problem right now. |
I think I finally figured out how to safely run integration tests for several target frameworks concurrently. I want to experiment with running tests concurrently on the command line too in order to improve execution time on AppVeyor. I'll let you know when it's ready. |
Before this commit, when single-file app was detected, the behaviour was to fallback on DLL scanning. But DLL scanning would not find anything for an app published as a single-file, by sheer definition of single-file app! After this commit, an exception is thrown if the app is published as a single-file AND no `Serilog:Using` section is defined in the configuration. The error message explains that either a `Serilog:Using` section must be added or show how to explicitly configure assemblies through the `ConfigurationReaderOptions`.
This is when the default DependencyContext is actually null. Also run all the tests on .NET 6 which is a Long Term Support (LTS) release.
Use a HashSet instead of a Dictionary keyed by the assembly full name. If an assembly is loaded twice with the same AssemblyName it will be the same instance so a HashSet (without even a custom IEqualityComparer<Assembly>) is the perfect solution. Also, Assembly.Load can throw many exceptions but won't return null.
… command line This works around dotnet/sdk#27202 It also has the benefit of using settings _only_ from the specified config file, ignoring the global nuget.config where package source mapping could interfere with the local source.
c9185a2
to
4828123
Compare
I finally figured out how to run tests concurrently across target frameworks, both in an IDE (Rider or Visual Studio) and on the command line with While working on this pull request, 66 out of 661 tests were not passing in build 46609632 but the final result on AppVeyor was still ✔️ with a Build success message on the last line. @SimonCropp I have seen that you've been working on |
Add a new PublishAsync(PublishMode) method and also add a comment explaining why it would not work to publish multiple apps in parallel.
This pull request is now ready to merge. |
Before this commit, when single-file app was detected, the behaviour was to fallback on DLL scanning. But DLL scanning would not find anything for an app published as a single-file, by sheer definition of single-file app!
After this commit, an exception is thrown if the app is published as a single-file AND no
Serilog:Using
section is defined in the configuration. The error message explains that either aSerilog:Using
section must be added or show how to explicitly configure assemblies through theConfigurationReaderOptions
.