Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Interfaces/ICachedRegisterBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public interface ICachedRegisterBlock : INotifyPropertyChanged
/// </summary>
bool HasChanges { get; }

/// <summary>
/// Gets the size of the cached block in bytes.
/// </summary>
int SizeInBytes { get; }

/// <summary>
/// Reads a section of the cache.
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions src/PanelFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ private static double GetMaxPixelWidthOfNames(Value[] values)

private static void AddValueControl(StackPanel panel, double nameWidth, Value value, ICachedRegisterBlock block)
{
var end = value.Address + value.Length;
if (end > block.SizeInBytes)
throw new InvalidOperationException($"The panel value '{value.Name}' at {value.Address} (length {value.Length}) ends at {end}, which exceeds the register block size ({block.SizeInBytes} bytes). Increase the config block's size, or reduce the panel addresses.");

UserControl newControl;
switch (value.Type)
{
Expand Down