Update All Packages lost unsaved changes
This is probably more a VS bug but here goes:
- Edit some files but do not save them
- Tools > Paket Dependencies Manager > Update All Packages
Think ^ is what I did, did not test if it is a repro. When the projects reloaded all unsaved changes were lost.
Suggested fix: Save or ask if user wants to save before running the command.
actually I thought we close the projects before updating. this should have triggered the save functions.
Yeah. I'm sure I raised a bug about this on the Paket VS repo a while ago, not sure if it was closed it bout, but I've seen this happening as well.
private void RunCommandAndReloadAllProjects(string helpTopic, Action<SolutionInfo> command)
{
PaketOutputPane.OutputPane.Activate();
PaketErrorPane.Clear();
StatusBarService.UpdateText("Paket command started.");
var info = new SolutionInfo();
info.Directory = SolutionExplorerExtensions.GetSolutionDirectory();
info.FileName = SolutionExplorerExtensions.GetSolutionDirectory();
var projectGuids = SolutionExplorerExtensions.GetAllProjectGuids();
SolutionExplorerExtensions.SaveSolution();
foreach (var projectGuid in projectGuids)
SolutionExplorerExtensions.UnloadProject(projectGuid);
System.Threading.Tasks.Task.Run(() =>
{
try
{
command(info);
PaketOutputPane.OutputPane.OutputStringThreadSafe("Ready\r\n");
StatusBarService.UpdateText("Ready");
}
catch (Exception ex)
{
PaketErrorPane.ShowError(ex.Message, info.FileName, helpTopic);
PaketOutputPane.OutputPane.OutputStringThreadSafe(ex.Message + "\r\n");
}
}).ContinueWith(_ =>
{
foreach (var projectGuid in projectGuids)
SolutionExplorerExtensions.ReloadProject(projectGuid);
});
}
that's weird...
The bug is very annoying. Is there any chance for the fix?
I'm happy to take PRs
Heck, it's annoying enough to have all your open document tabs unceremoniously get closed, and then worst of all, they're not restored when Paket extension is done doing its thing. Pretty poor UX. Not a fan. NuGet can restore/update packages without closing the project--so what's the deal here?
Nuget is using VS apis to add or remove references. That works to some degree but is also very flaky.
In the new csproj/fsproj project system with MSBuild 15 this is basically solved.
For this addin here I'm still waiting for someone to contribute a fix. I personally don't use the addin.