caoyue / WindowResizer

Save and restore your windows size and position with hotkeys
MIT License
189 stars 11 forks source link

Error when saving and removing entries with "Resize by Title" deactivated #73

Open Jamire opened 9 months ago

Jamire commented 9 months ago

Hi,

there seems to be a problem with saving and removing of process entries when Resize by Title is deactivated.

Deactivate this option and a newly created process entry will not be shown, only after a restart.

If there are process entries and the option is deactivated and an entry should be removed, an error message appears ("An error occurred, check the log file"). In the log, the following is shown:

[24.01.2024 11:35:07]Error: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) at System.Collections.Generic.List`1.get_Item(Int32 index) at WindowResizer.SettingForm.ProcessesGrid_CellFormatting(Object sender, DataGridViewCellFormattingEventArgs e) at System.Windows.Forms.DataGridView.OnCellFormatting(DataGridViewCellFormattingEventArgs e) at System.Windows.Forms.DataGridView.OnCellFormatting(Int32 columnIndex, Int32 rowIndex, Object val, Type formattedValueType, DataGridViewCellStyle cellStyle) at System.Windows.Forms.DataGridViewCell.GetFormattedValue(Object value, Int32 rowIndex, DataGridViewCellStyle& cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context) at System.Windows.Forms.DataGridViewTextBoxCell.GetPreferredSize(Graphics graphics, DataGridViewCellStyle cellStyle, Int32 rowIndex, Size constraintSize) at System.Windows.Forms.DataGridViewCell.GetPreferredWidth(Int32 rowIndex, Int32 height) at System.Windows.Forms.DataGridViewCell.OnCellDataAreaMouseEnterInternal(Int32 rowIndex) at System.Windows.Forms.DataGridViewCell.OnMouseMoveInternal(DataGridViewCellMouseEventArgs e) at System.Windows.Forms.DataGridView.OnCellMouseMove(DataGridViewCellMouseEventArgs e) at System.Windows.Forms.DataGridView.UpdateMouseEnteredCell(HitTestInfo hti, MouseEventArgs e) at System.Windows.Forms.DataGridView.OnMouseMove(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseMove(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

After the restart, the removed entry is no longer present.

caoyue commented 9 months ago

Hi, I can reproduce it. Sorry for the inconvenience, it will be fixed in the next release.