-
Notifications
You must be signed in to change notification settings - Fork 308
Porting "Always log startup exceptions to 1.1.4" #1184
Conversation
@jkotalik, |
Why is the branch 1.1.4? Shouldn't it be 1.1.3? cc @pranavkm |
1368d1c
to
3f7cb64
Compare
var builder = CreateWebHostBuilder() | ||
.CaptureStartupErrors(false) | ||
.ConfigureServices(collection => collection.AddSingleton<ILoggerFactory>(factory)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove empty line
|
||
Assert.Throws<InvalidOperationException>(() => builder.Build()); | ||
|
||
Assert.True(testSink.Writes.Any(w => w.Exception?.Message == "Startup exception")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assert.Contains("Startup exception", testSink.Writes.Select(w => w.Exception?.Message).Where(m => m != null));
is slightly better because it'll cause xunit to print the 2nd argument (the haystack). Helps when the test fails. With the current approach all you get is a Assert.True(false)
which is less useful.
@muratg yup, the branch needs to @jkotalik you'll have to a) Create a |
FYI, don't bump the version of Hosting to 1.1.3 in this PR, use Coherence-Patch according to the instruction in the email instead. |
Closing to merge with rel/1.1.3 |
Thanks folks! We should ensure the other patch check-ins follow these guidelines as well. |
Fix for #1160
Had to modify tests to work with 1.1.x