EWSoftware / SHFB

Sandcastle Help File Builder (SHFB). A standalone GUI, Visual Studio integration package, and MSBuild tasks providing full configuration and extensibility for building help files with the Sandcastle tools.
Other
2.2k stars 367 forks source link

New VS resource manager crashes with SHFB project in solution #1086

Open NerdyDuck opened 1 week ago

NerdyDuck commented 1 week ago

VS 17.12 has a new resource manager, aggregating all resource files in a solution. Unfortunately, if a SHFB project is present in the project (and loaded), the resource manager crashes with this error:

Microsoft.VisualStudio.ProjectSystem.Query.MissingDataException: Data is not available for property 'Capabilities'. Update the query to retrieve the data.
   at Microsoft.VisualStudio.ProjectSystem.Query.Framework.ProjectSnapshot.get_Capabilities()
   at Microsoft.VisualStudio.ResourceExplorer.IO.SolutionLoader.<LoadInitialFilesInProjectAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ResourceExplorer.IO.SolutionLoader.<HandleProjectLoadAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ResourceExplorer.IO.SolutionLoader.<LoadSolutionAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ResourceExplorer.UI.ResourceExplorerControl.<>c__DisplayClass2_0.<<TryPopulateSolution>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ResourceExplorer.UI.AsyncLoadContent.<>c__DisplayClass0_0.<<Initialize>b__0>d.MoveNext()

If I unload the SHFB project, and restart VS, it works fine. It's not a problem of non-.NET projects in general, as I also have mixed solutions with C# and C that work fine.

EWSoftware commented 1 week ago

I can't duplicate the issue so it may be specific to a particular project type. Can you provide an example?

NerdyDuck commented 1 week ago

Interesting. I created a minimal project and published it: NerdyDuck/ResManTest The resource manager stopped working the moment I added the SHFB project to the solution.

It may be worth mentioning that I had previously installed the ResXManager extension, but uninstalled it when the new manager was introduced. Maybe it left some remnants in the VS config that now interferes with the new resource manager in very strange circumstances. I may have to verify the bug in a fresh installation.

NerdyDuck commented 1 week ago

Update: I installed VS 17.12 (Pro) on a clean VM, did not log in with my account to prevent any bad config to be loaded, installed latest SHFB, and cloned the repo mentioned before. Still get the error.

EWSoftware commented 1 week ago

It looks like the resource manager is making an assumption about the projects in the solution all using the new common project system. SHFB doesn't use that. It uses the old MPF project system from way back in VS 2010. Still works so I haven't bothered trying to rewrite everything to use the newer CPS which would be a lot of work and isn't going to happen any time soon.

There's a Developer Community report for the same issue. Not sure if it's also related to a SHFB project in that case. I've commented on the issue there.

NerdyDuck commented 1 week ago

The old project system is a very likely reason for the problem. It's understandable that you don't want to invest the time to move to the common project system, as long as the old one still works. Let's see how Microsoft reacts to the issue. In the meantime I will "exile" my doc projects into their own solutions. Makes for faster unit testing anyways.

EWSoftware commented 6 days ago

A workaround is to right click on the SHFB project and unload it. If you've tried opening a resource file, you need to restart Visual Studio but if not, the editor works. The SHFB project remains in an unloaded state even if you close and reopen the solution until you reload it again.