Skip to content

Add newer version info in file version error#660

Merged
KirillOsenkov merged 1 commit intoKirillOsenkov:mainfrom
JanKrivanek:proto/newer-v-info-in-error
Feb 28, 2023
Merged

Add newer version info in file version error#660
KirillOsenkov merged 1 commit intoKirillOsenkov:mainfrom
JanKrivanek:proto/newer-v-info-in-error

Conversation

@JanKrivanek
Copy link
Copy Markdown
Collaborator

Context

dotnet/msbuild#8316 (comment)

When opening log with new version, first attempt fails and app needs to be restarted to run the updated bits. This situation might not be clear to unexperienced user from the error message.

Change

Propagating info about available update into the logic layer, so that this can be appended to version not supported error.
For simplicity the propagation of info is done via a bit ugly way. Alternatively we can pass some optional version info holder into Serialization.Read to keep the current encapsulation - I'm open to suggestions here.

Testing

Manual tests via manipulating latest known file format and update check:

System.NotSupportedException: Unsupported log file format. Latest supported version is 16, the log file has version 15. Update available - restart this instance to automatically use newer version.
   at Microsoft.Build.Logging.StructuredLogger.BinLogReader.EnsureFileFormatVersionKnown(Int32 fileFormatVersion) in C:\src\binlog-viewer\src\StructuredLogger\BinaryLogger\BinLogReader.cs:line 153
   at Microsoft.Build.Logging.StructuredLogger.BinLogReader.Replay(Stream stream, Progress progress) in C:\src\binlog-viewer\src\StructuredLogger\BinaryLogger\BinLogReader.cs:line 69
   at Microsoft.Build.Logging.StructuredLogger.BinaryLog.ReadBuild(Stream stream, Progress progress, Byte[] projectImportsArchive) in C:\src\binlog-viewer\src\StructuredLogger\BinaryLog.cs:line 104
   at Microsoft.Build.Logging.StructuredLogger.BinaryLog.ReadBuild(String filePath, Progress progress) in C:\src\binlog-viewer\src\StructuredLogger\BinaryLog.cs:line 41
   at Microsoft.Build.Logging.StructuredLogger.Serialization.Read(String filePath, Progress progress) in C:\src\binlog-viewer\src\StructuredLogger\Serialization\Serialization.cs:line 71
   at StructuredLogViewer.MainWindow.<>c__DisplayClass29_0.<OpenLogFile>b__3() in C:\src\binlog-viewer\src\StructuredLogViewer\MainWindow.xaml.cs:line 413

image

Copy link
Copy Markdown
Owner

@KirillOsenkov KirillOsenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@KirillOsenkov KirillOsenkov merged commit 512f695 into KirillOsenkov:main Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants