-
Notifications
You must be signed in to change notification settings - Fork 391
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 up to date check & improve logging #2332
Fix up to date check & improve logging #2332
Conversation
public void Info(string message, params object[] values) => Log(LogLevel.Info, message, values); | ||
|
||
public void Verbose(string message, params object[] values) => Log(LogLevel.Verbose, message, values); | ||
} |
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.
Line Break
} | ||
else | ||
{ | ||
Log(logger, "One or more outputs do not exist."); | ||
logger.Info("Output '{0}' does not exist.", earliestOutput.path); | ||
} | ||
|
||
// We are up to date if the earliest output write happened before the latest input write |
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.
May be I am not reading this correct.
I would expect the condition to be, we are up to date if the latest input write is before the earliest output write? meaning, we are only update as long as all the outputs are created after last the input write has been made.
{ | ||
if (level <= _requestedLogLevel) | ||
{ | ||
_logger?.WriteLine("FastUpToDate: " + string.Format(message, values) + " (" + Path.GetFileNameWithoutExtension(_projectPath) + ")"); |
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 you interploated string here
{ | ||
if (level <= _requestedLogLevel) | ||
{ | ||
_logger?.WriteLine("FastUpToDate: " + string.Format(message, values) + " (" + Path.GetFileNameWithoutExtension(_projectPath) + ")"); |
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.
Path.GetFileNameWithoutExtension(_projectPath)
can be cached
@@ -18,6 +18,31 @@ namespace Microsoft.VisualStudio.ProjectSystem | |||
[Export(typeof(IBuildUpToDateCheckProvider))] | |||
internal sealed class BuildUpToDateCheck : OnceInitializedOnceDisposed, IBuildUpToDateCheckProvider | |||
{ | |||
private sealed class Logger |
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.
New file may be?
Tagging @MattGertz for approval. |
} | ||
|
||
private void Log(LogLevel level, string message, params object[] values) | ||
{ | ||
if (level <= _requestedLogLevel) | ||
{ | ||
_logger?.WriteLine("FastUpToDate: " + string.Format(message, values) + " (" + Path.GetFileNameWithoutExtension(_projectPath) + ")"); | ||
_logger?.WriteLine($"FastUpToDate: {string.Format(message, values)} ({Path.GetFileNameWithoutExtension(_fileName)})"); |
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.
You dont need Path.GetFileNameWithoutExtension(_fileName)
instead just _fileName
because Path.GetFileNameWithoutExtension
is already applied on _fileName
Customer scenario
The fast up to date check is broken since it erroneously believes all projects have opted out of up to date checks. Also, logging is too verbose and needs to be reined in to be useful in large solutions. This adds levels of logging that allow more terse logging that can be useful to see problems and then more verbose logging to diagnose issues.
Workarounds, if any
None.
Risk
Low, fixes a broken new feature.
Performance impact
Just turned on a broken feature.
Is this a regression from a previous update?
No.
Root cause analysis:
We're currently missing integration tests for fast up to date. Once integration tests are actually running again, I'm going to add tests to prevent breaks like this.
How was the bug found?
Ad hoc testing.