eamodio / SaveAllTheTabs

Quickly save and restore sets of document tabs in Visual Studio
MIT License
67 stars 30 forks source link

Fix exception on saving many tab groups #28

Open andronov-alexey opened 4 years ago

andronov-alexey commented 4 years ago

Problem cause:

The problem arises when user tries to store too many tab groups. Since we store all tab groups (with full paths to all open tabs for each group) in one string and windows registry's max string length is 1MB we pretty quickly reach this limit and registry key storing operation fails.

Solution:

I propose to store each tab group in its own registry key instead of saving all groups in one key. This way the amount of groups becomes unlimited and length limit for all tabs paths for one group is ~500k (aforementioned 1 MB)

Results:

Here's how the registry storage look like before and after the proposed change: BeforeAfter

Important:

This version will save open tabs in different format in registry so previous versions of this extension won't be able to open it (but they could still work with their "old" format).

Additional fixes:

More:

I've also merged this bugfix with MSVC2019 support fix and published it on Open VSIX Gallery. Feel free to download and test it :)

Resolves #27

nickwigton commented 4 years ago

Had used SaveAllTheTabs for VS2017 for a while, gave the published version of this a try for VS2019, having no issues. Thank you for doing this. Here's hoping the PR is accepted.

djayfresh commented 3 years ago

So this plug in will no longer suppor VS2017?

`

857
<time>2020/10/02 18:09:12.417</time>
<type>Error</type>
<source>VisualStudio</source>
<description>CreateInstance failed for package [SaveAllTheTabsPackage]Source: &apos;mscorlib&apos; Description: Could not load file or assembly &apos;Microsoft.VisualStudio.Shell.15.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos; or one of its dependencies. The system cannot find the file specified.&#x000D;&#x000A;System.IO.FileNotFoundException: Could not load file or assembly &apos;Microsoft.VisualStudio.Shell.15.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos; or one of its dependencies. The system cannot find the file specified.&#x000D;&#x000A;File name: &apos;Microsoft.VisualStudio.Shell.15.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos;&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)&#x000D;&#x000A;   at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)&#x000D;&#x000A;   at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)&#x000D;&#x000A;   at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)&#x000D;&#x000A;&#x000D;&#x000A;WRN: Assembly binding logging is turned OFF.&#x000D;&#x000A;To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.&#x000D;&#x000A;Note: There is some performance penalty associated with assembly bind failure logging.&#x000D;&#x000A;To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].&#x000D;&#x000A;</description>
<guid>{A0217E5B-1DFA-4FA1-98AA-7550D6A32076}</guid>
<hr>80004005 - E_FAIL</hr>
<errorinfo></errorinfo>

`

Unable to open extension inside VS2017. Was still having issue [#27] which is why I just tried this updated version.