Conversation
…cation Split the memory dump process into two distinct stages: dumper payload installation (Stage 10) and memory dump invocation (Stage 11). This separation improves progress tracking accuracy and eliminates redundant dumper uploads for multi-segment dumps. Updated progress percentages and stage numbering accordingly across both BootloaderService and EnhancedBootloaderService implementations.
…mprove task scheduling - Add DumpCount property to JobProfile and JobProfileSet for configurable dump iterations - Update bootloader services to return IList<byte[]> instead of single byte array - Implement separate file saving for multiple dumps with iteration naming - Replace multiple timers in EnhancedTaskScheduler with single schedule timer - Add immediate task persistence on state changes and scheduler triggering - Split task persistence into active tasks file and history file - Fix TaskExecution.Empty pattern and improve UI state management - Optimize progress reporting with throttled speed calculations - Add pre-validation for TCP port availability in SocatService
…ations - Replace manual Task.Delay calls with WaitWithProgressAsync for consistent progress tracking - Adjust progress percentages to allocate 75% weight to memory dump phase (20-95%) - Add multi-iteration dump support with detailed per-segment progress reporting - Unify progress calculation logic between BootloaderService and EnhancedBootloaderService - Update stage names for better clarity (power_off_wait, power_on_stabilize, power_cycle_wait) - Enhance output description to show individual file sizes and paths for multiple dump files - Remove obsolete comments and improve code consistency across both service implementations
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Removed the calculation of total dump size and its overflow handling.
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
… log viewer - Add auto-scroll toggle with smart scroll detection in TaskDetailsView and LogViewerView - Implement BaseBootloaderService to share common memory dump logic between bootloader services - Replace DataGrid with ListBox in LogViewerView for better performance and scroll control - Add context menus with copy functionality to log grids and entries - Restructure TaskManagerView layout with split view and GridSplitter for better space utilization - Add toolbar with auto-scroll controls to TaskDetailsView - Refactor memory dump process into shared base class to reduce code duplication - Update project output type from WinExe to Exe for better debugging
…sualization - Implement DumperService using System.IO.Pipelines for zero-copy network ingestion - Add ProtocolParser for efficient parsing of fragmented PLC memory streams - Create MemoryDumpOrchestrator for UI thread batching and performance optimization - Add MemoryDumpViewerViewModel and View for real-time hex viewer interface - Extend BaseBootloaderService with streaming dump methods for 80% memory reduction - Integrate streaming capabilities into PlcClientAdapter and PlcMemoryManager - Add Memory Dump Viewer to navigation with dedicated activity bar item - Register new services in DI container for pipeline architecture
Refactor file logging to use async channels and deprecate blocking UI thread methods - Replace FileLogger with AsyncFileLogger using System.Threading.Channels for deadlock-free logging - Add proper async disposal pattern with IAsyncDisposable support - Mark TryInvokeOnUIThread methods as obsolete due to deadlock risks from blocking .Wait() calls - Improve logging performance with batched writes and background processing
…nents Split monolithic SocatService into four focused services following single responsibility principle: - SocatCommandBuilder: command generation and validation - SocatProcessManager: process lifecycle management with event handling - SocatPortManager: TCP port checking and network connections - SocatConfigurationService: serial device preparation and validation SocatService now acts as a facade orchestrating these specialized components while maintaining backward compatibility during incremental refactoring.
…services - Replace direct port checking with PortManager delegation - Rename internal collections for clarity (_activeProcesses -> _managedProcesses, _processMonitors -> _monitoringTimers) - Simplify external process discovery by delegating to PortManager - Remove redundant logging and inline port checking logic - Update comments to reflect facade pattern architecture - Streamline connection enumeration and transfer stats methods
Split the monolithic SerialPortService into three focused services: - SerialPortDiscoveryService: handles port scanning and device info - SerialPortConfigurationService: manages stty commands and port config - SerialPortMonitoringService: handles change detection and events Added IShellCommandExecutor interface and implementation to centralize shell command execution across services. Updated SocatProcessManager to use the new shell executor. The main SerialPortService now acts as a facade, maintaining backward compatibility while delegating to specialized services. This improves testability, separation of concerns, and maintainability.
- Update DateTime test fixtures to use explicit DateTimeKind.Local and proper timezone handling - Add FallbackValue bindings to ProgressBar properties to prevent binding errors - Set Speed column binding to OneWay mode for better performance - Update TaskManagerViewModel constructor with additional required dependencies - Improve TaskLoggerFactory channel reader count check with CanCount guard - Implement proper disposal pattern in MemoryDumpViewerViewModel - Return null instead of throwing in ByteSpeedConverter.ConvertBack for OneWay scenarios
…e dependency injection - Extract common orchestration logic from BootloaderService and EnhancedBootloaderService into BaseBootloaderService.PerformBootloaderOrchestrationAsync() - Remove duplicate constants, retry configuration methods, and progress simulation logic - Create TaskStatisticsViewModel to separate statistics calculation from TaskManagerViewModel - Refactor PathService to use lazy dependency injection via IServiceProvider to avoid circular dependencies - Replace FileLogWriter with FileLogSink implementing ILogSink interface for better integration with UnifiedLoggerProvider - Update service registration and initialization to use new sink-based logging architecture - Add Task.Yield() in MemoryDumpViewerViewModel to ensure UI responsiveness during operations
- Add dotnet-install.sh script for automated .NET SDK/runtime installation - Remove extra spacing after 8th byte in hex viewer column rendering - Reduce hex viewer column padding from 30 to 15 for better layout
…NET 10 - Replace embedded AvaloniaHex controls with AvaloniaHex NuGet package - Update target framework from .NET 8.0 to .NET 10.0 across all projects - Add comprehensive hex viewer menu with font size, bytes per line, and column visibility options - Implement data inspector navigation and fill selection functionality - Add configurable view properties for hex editor customization - Remove local AvaloniaHex implementation files - Update Avalonia packages to version 11.3.10
…nagement, and editing features, along with corresponding updates to the HexView application and its samples.
- Restructure DataInspectorView with TabControl containing Values and Search tabs - Implement SearchViewModel with support for hex, string, and binary pattern search modes - Add BinarySearchService for efficient pattern matching across large files with chunked reading - Integrate search results navigation with hex editor positioning - Add comprehensive unit tests for binary search functionality - Update document lifecycle management in HexViewerViewModel
Refactor SocatService to use explicit dependency injection instead of reflection
Add proper shell escaping for serial port paths in stty and lsof commands by wrapping paths in single quotes and escaping embedded single quotes. This prevents command injection attacks when port paths contain malicious characters or shell metacharacters.
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||||||||||
Summary of ChangesHello @efargas, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request delivers significant architectural enhancements and new features, primarily focusing on advanced memory analysis and improved system stability. The introduction of a real-time hex viewer and high-performance streaming for PLC memory dumps provides powerful new debugging and analysis capabilities. Concurrently, a substantial refactoring effort has modularized core services, making the codebase more robust and easier to extend. These changes, coupled with a .NET 9.0 upgrade and comprehensive documentation improvements, lay a stronger foundation for future development and enhance the overall developer and user experience. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This is an impressive and extensive pull request that introduces major refactorings and a new Hex Viewer feature. The architectural improvements are significant, including:
- Refactoring
SerialPortServiceandSocatServiceinto facades with specialized services, which greatly improves separation of concerns. - Introducing a
BaseBootloaderServiceto centralize the bootloader orchestration workflow, effectively reducing code duplication. - Modernizing the task scheduler with a single dynamic timer and improved persistence.
- Implementing a high-performance, zero-allocation memory dump ingestion service (
DumperService) usingSystem.IO.Pipelines. - Replacing synchronous file logging with an async-safe logger using
System.Threading.Channels.
The overall code quality of the new and refactored components is very high.
However, there are a few critical issues that need to be addressed:
- Disabled Tests: The entire test suite for
BootloaderServicehas been commented out. A refactoring of this scale must be accompanied by updated tests to ensure correctness and prevent regressions. Please update the tests to match the new service implementation. - Invalid JSON Files: Two metadata files (
migration-log.jsonandmigration-tracking.json) have been modified in a way that makes them invalid JSON by appending markdown content. This will break any tools that rely on parsing these files.
|
|
||
| ## Related Documentation | ||
|
|
||
| - [_Index](../guides/migration/_index.md) | ||
|
|
||
| --- | ||
| *This section is auto-generated. Do not edit manually. Last updated: 2026-01-17* |
There was a problem hiding this comment.
|
|
||
| ## Related Documentation | ||
|
|
||
| - [_Index](../archive/_index.md) | ||
|
|
||
| --- | ||
| *This section is auto-generated. Do not edit manually. Last updated: 2026-01-17* |
- Upgrade target framework from net8.0 to net9.0 across all projects - Replace traditional null checks with ArgumentNullException.ThrowIfNull() - Modernize collection initializers using [] syntax instead of new() - Convert constructors to primary constructor syntax where appropriate - Add global using statements to reduce code duplication - Update bootloader service signatures to support enhanced progress reporting - Fix clipboard service API usage for Avalonia compatibility - Remove unused test placeholders and update test assertions
User description
/describe
PR Type
Enhancement, Tests
Description
Major refactoring to facade and service specialization patterns: Refactored
SerialPortService,SocatService, andTaskManagerViewModelto use facade pattern with specialized services for improved separation of concerns and maintainabilityNew bootloader orchestration framework: Introduced
BaseBootloaderServicewith unified 13-stage bootloader workflow and streaming support, withBootloaderServiceandEnhancedBootloaderServicenow inheriting from itEnhanced task scheduling system: Consolidated multiple timers into single dynamic scheduler with dual persistence (active and history tasks), explicit task removal, and on-demand processing via
TriggerScheduler()High-performance memory dump ingestion: Added
DumperServiceusing System.IO.Pipelines for zero-allocation async processing with greeting detection and multi-segment dump supportImproved logging architecture: Replaced synchronous file logging with async-safe
AsyncFileLoggerusing channels, removed protocol logging, and updatedFileLogSinkto useIOptionsdependency injection patternDynamic UI task management: Enhanced
BottomPanelViewModelwith dynamic task-specific log tabs and integratedTaskManagerViewModelwith newTaskCommandManagerandTaskStatisticsViewModelfor centralized command handlingNew specialized services: Added
SerialPortDiscoveryService,SerialPortConfigurationService,SerialPortMonitoringService,SocatProcessManager,SocatCommandBuilder,SocatPortManager,SocatConfigurationService, andShellCommandExecutorHex viewer infrastructure: Added
PlcTransportAdapter.GetStream()accessor and new hex viewer view models and services for binary data inspection and searchingComprehensive DI container updates: Extended service registration with all new specialized services and view models
Test updates: Disabled
BootloaderServiceTestsdue to signature mismatches; added new tests for serial port and hex viewer functionalityDiagram Walkthrough
File Walkthrough
15 files
BaseBootloaderService.cs
New BaseBootloaderService with unified bootloader orchestrationsrc/S7Tools/Services/Bootloader/BaseBootloaderService.cs
memory dumping logic
support
simplified streaming approaches
comprehensive error handling
SocatService.cs
SocatService refactored to facade pattern with specialized servicessrc/S7Tools/Services/SocatService.cs
(CommandBuilder, ProcessManager, PortManager, ConfigurationService)
FileLogSink.cs
FileLogSink updated to use IOptions dependency injection patternsrc/S7Tools.Infrastructure.Logging/Sinks/FileLogSink.cs
IOptionspattern instead of directconfiguration
pathService parameters
Microsoft.Extensions.Options conventions
SerialPortService.cs
Refactor SerialPortService to Facade Pattern with Specialized Servicessrc/S7Tools/Services/SerialPortService.cs
SerialPortServicefrom a monolithic implementation into afacade pattern delegating to specialized services
(
SerialPortDiscoveryService,SerialPortConfigurationService,SerialPortMonitoringService)stty command execution, USB device detection, and monitoring logic
ITimeProviderand internal state managementcompatibility with
ISerialPortServiceinterfacedelegated to
SerialPortMonitoringServiceTaskManagerViewModel.cs
Refactor TaskManagerViewModel with Command Manager and StatisticsSeparationsrc/S7Tools/ViewModels/Tasks/TaskManagerViewModel.cs
TaskStatisticsViewModelandTaskCommandManagerdependenciesfor separation of concerns
SelectedTaskfrom nullable to non-nullable usingTaskExecution.Emptysentinel valueTotalTasksCount,RunningTasksCount,FailedTasksCount,AverageExecutionTime,ResourceUtilization) and delegated toTaskStatisticsViewModelsubjects to prevent UI freezing
TaskCommandManagerfor centralized command handling and resultprocessing
UpdateCommandResult()andHandleCommandException()for consistent error handlingEnhancedBootloaderService.cs
Refactor EnhancedBootloaderService to Use Base Orchestrationsrc/S7Tools/Services/Bootloader/EnhancedBootloaderService.cs
DumpAsync()return type frombyte[]toBootloaderResulttoprovide structured result with file paths and metadata
DumpAsync()anddelegated to
PerformBootloaderOrchestrationAsync()base methodDumpWithTaskTrackingAsync()to work withBootloaderResultinstead of raw byte arrays
protocolLoggerparameter from method signaturesorchestration
EnhancedTaskScheduler.cs
Refactor Task Scheduler with Dynamic Timer and Dual Persistencesrc/S7Tools/Services/Tasking/EnhancedTaskScheduler.cs
_processingTimer,_cleanupTimer,_persistenceTimer) into single_scheduleTimerwith dynamicrescheduling
TriggerScheduler()method for on-demand task processinginstead of fixed intervals
RemoveTaskAsync()andClearFinishedTasksAsync()methods forexplicit task removal
two files (
Tasks.jsonandTasks_History.json)persistence
SaveTasksAsync()calls after state changes instead ofrelying on periodic timer
rescheduling based on next scheduled time
request
BottomPanelViewModel.cs
Add Dynamic Task Log Tabs to Bottom Panelsrc/S7Tools/ViewModels/Layout/BottomPanelViewModel.cs
TaskManagerViewModeldependency andICentralizedTaskLogServicefor task log integration
when tasks are added to
ActiveTasksAddNewTaskTab()andRemoveTaskTab()methods to handle tasklifecycle in UI
CloseTabCommandandCloseTab()method for closable tab supportdefault
SelectTabCommandparameter type fromPanelTabItemtoPanelTabItem?to handle null selectionsTaskManagerViewModelandICentralizedTaskLogServiceparametersPlcTransportAdapter.cs
Add Stream Accessor to PlcTransportAdaptersrc/S7Tools/Services/Adapters/PlcTransportAdapter.cs
GetStream()method to expose the underlyingStreamforexternal access
SerialPortConfigurationService.cs
New serial port configuration management servicesrc/S7Tools/Services/SerialPort/SerialPortConfigurationService.cs
commands
configurations
detection
SerialPortConfigurationobjectsSocatProcessManager.cs
New socat process lifecycle management servicesrc/S7Tools/Services/Socat/SocatProcessManager.cs
monitor)
SerialPortDiscoveryService.cs
New serial port discovery and scanning servicesrc/S7Tools/Services/SerialPort/SerialPortDiscoveryService.cs
serial number)
DumperService.cs
New high-performance PLC memory dump servicesrc/S7Tools/Services/Adapters/Plc/DumperService.cs
System.IO.Pipelines
Pipeand async processing withChannelsbyte skipping
TaskLoggerFactory.cs
Remove protocol logging and implement async file loggersrc/S7Tools/Services/Logging/TaskLoggerFactory.cs
captureProtocolparameter fromCreateTaskLoggerAsyncmethodFileLoggerwith async-safeAsyncFileLoggerusingChannelIAsyncDisposableandIDisposableinterfaces
TaskLoggerContextclassTaskCommandManager.cs
New task command manager for operation handlingsrc/S7Tools/ViewModels/Tasks/TaskCommandManager.cs
resume, restart, delete)
time)
CommandResultstruct with success/failure/cancelled states1 files
BootloaderServiceTests.cs
BootloaderServiceTests temporarily disabled for refactoringtests/S7Tools.Tests/Services/Bootloader/BootloaderServiceTests.cs
BootloaderService
handling disabled
signatures
1 files
BootloaderService.cs
Refactor bootloader dump orchestration to base classsrc/S7Tools/Services/Bootloader/BootloaderService.cs
IBootloaderServicetoBaseBootloaderService(timeProvider), IBootloaderServiceDumpAsyncreturn type frombyte[]toBootloaderResultprotocolLoggerparameter from method signaturePerformBootloaderOrchestrationAsync_timeProviderand constantInitialPowerOffWaitMsWaitWithProgressAsync1 files
ServiceCollectionExtensions.cs
Extend DI container with new services and view modelssrc/S7Tools/Extensions/ServiceCollectionExtensions.cs
IShellCommandExecutorsingleton registration(
SerialPortDiscoveryService,SerialPortConfigurationService,SerialPortMonitoringService)SocatCommandBuilder,SocatProcessManager,SocatPortManager,SocatConfigurationService)SocatServiceregistration to inject new specialized servicesFileLogSinkasILogSinkfor unified logger providerTaskCommandManagerandTaskStatisticsViewModelregistrationsPathService101 files