-
Notifications
You must be signed in to change notification settings - Fork 694
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
fix incorrect as usage in ProjectFactory #6191
fix incorrect as usage in ProjectFactory #6191
Conversation
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.
Can we please get an issue created for this and the PR template filled out?
c7db036
@@ -143,24 +143,15 @@ private void Initialize(dynamic project) | |||
} | |||
|
|||
// This happens before we obtain warning properties, so this Logger is still IConsole. | |||
IConsole console = Logger as IConsole; | |||
switch (LogLevel) | |||
if (Logger is IConsole console) |
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.
A lot of tests were failing because Logger was NullLogger
which resulted in an invalid cast exception. Instead of as
we could use is
and do a onetime check if the Logger is an IConsole
type.
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.
Another thing we could do is
if (LogLevel != LogLevel.Debug)
{
var console = (IConsole)Logger;
console.Verbosity = LogLevel switch
{
LogLevel.Verbose => Verbosity.Detailed,
LogLevel.Information => Verbosity.Normal,
LogLevel.Minimal => Verbosity.Quiet,
_ => console.Verbosity
};
}
And in our tests make sure LogLevel == LogLevel.Debug
Bug
Fixes:
Description
PR Checklist