dotnet / dotnet/winforms

Incorrect toolbar location when restored via `ToolStripManager.LoadSettings`

Open
#4,449 4 comments 0 reactions 0 assignees View on GitHub
:beetle: bug :construction: work in progress area-controls-StripControls area-Layout help wanted tenet-compatibility
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
1d 13m
Merged PRs (30d)
85

Description

Presumably all versions:
* .NET Framework: 4.6.1 (tested)
* .NET Version: 5.0 (tested)

**Problem description:**

Originally reported in https://github.com/gitextensions/gitextensions/issues/8680.

If an application has multiple toolbars, and those are placed at an arbitrary location and persisted via `ToolStripManager.SaveSettings`, not all toolbars will be correctly located once `ToolStripManager.LoadSettings` is called.
E.g. on save:
![image](https://user-images.githubusercontent.com/4403806/104114132-0409aa80-5355-11eb-81fb-54dc4c324249.png)

On load:
![image](https://user-images.githubusercontent.com/4403806/104114140-213e7900-5355-11eb-9735-718cefab6bec.png)

**Expected behavior:**

The location of the toolbars persisted in the config must be preserved.

**Minimal repro:**

1. clone https://github.com/RussKie/Test-ToolStripLoad
1. Run the app, align both toolbars to the left one under another.
2. Stop the app.
3. Open the user.config file, located somethere at `C:\Users\\AppData\Local\ToolstripLoad\ToolstripLoad_Url_\1.0.0.0`, check that both toolbars' locations are like this:
```xml


ToolStripFilters


7, 25




ToolStripMain


7, 0


```
4. Run the app again and observe the bottom toolbar shifted by few pixels to the right.
5. Close the app and see that the location value for `ToolStripFilters` has changed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.