Keep the log view following and readable: network-share tailing, bulk row-cap trim, selection contrast #9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/network-share-tailing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What does this PR do?
Three fixes that all keep the combined log view showing new lines reliably and legibly.
1. Detect appended data on network shares
Tailing could stop showing new lines on a UNC / SMB share because new-content detection relied on
FileStream.Length, which the SMB redirector can cache as a stale (smaller) value, so the tailer concluded there was nothing new even while the file kept growing. A restart did not recover it because the stale length lives in the OS redirector, not in the app.FileTailer.ReadNewnow seeks to the last offset and reads through to the real end of stream (reads until a zero-byte read) instead of bounding reads by the cachedfs.Length.fs.Lengthis now used only for truncation / rotation detection.FolderTailerraises aDiscoveryCompletedevent after discovery (so the UI can show "Following" and the matched-file count before the first new line), handlesFileSystemWatcher.Error(buffer overflow / dropped watch) by forcing a rescan while the periodic poll carries on, and bumpsInternalBufferSizeto 64 KB.2. Trim the row cap in bulk
Once the view reached its row cap (
MaxRows, 50,000 by default), each poll trimmed the overflow with a per-rowObservableCollection.RemoveAt(0)loop. Every removal raised its own collection-changed event, each driving aDataGridlayout pass; at the cap under a fast log rate that is thousands of events per poll, which saturated the UI thread and made the display appear to stop showing new lines.BoundedLogCollection.TrimHead(max)drops the oldest rows via a singleList.RemoveRangeand one reset notification instead of one event per row.AppendRowslets the buffer grow a little past the cap then bulk-trims, so a trim (and any scroll reposition when auto-scroll is off) happens rarely; additions stay incremental so appending does not disturb the scroll position.3. Keep selected rows readable
With full-row selection the default theme left the log text dark on a pale highlight (fainter still when the grid is unfocused), so a clicked row lost contrast; the transparent compact cells let that show through. An
IsSelectedtrigger now paints selected cells white-on-blue whether or not the grid is focused.How was this tested?
dotnet build Tayler.slnx -c Debug- 0 errors, 0 warningsMaxRows=20and appended 200 lines quickly - the view stayed responsive, trimmed to the newest 20 rows, and showed "20 rows - Following".Checklist
Fix log tailing stalling on network shares; richer status barto Keep the log view following and readable: network-share tailing, bulk row-cap trim, selection contrast