codecadwallader / codemaid

CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
http://www.codemaid.net
GNU Lesser General Public License v3.0
1.89k stars 356 forks source link

Spade working erratically / Not at all in VS2022 #864

Open cdanek opened 2 years ago

cdanek commented 2 years ago

Environment

Description

There are some situations where Spade fails to render an outline for the current file.

Recreation

Unfortunately, I was not able to replicate this issue consistently. I tried making a new file (no render), adding members to it (no render), saving it (no render), copying and pasting another file's contents into the new file (no render), then saving it (successfully rendered the outline), and then repeating those steps exactly, where it failed. Sorry - tried very hard to narrow down the case and duplicate the bug!

Current behavior

CodeMaid Spade window briefly shows a "spinner" while parsing the file, then displays no contents.

Expected behavior

Spade should display the members of the current file.

cdanek commented 2 years ago

As an addendum, this issue was first noticed after I leveraged some new features of VS2022/C#9 and 10 - global usings, file level namespace, and removing the ceremony from a Main function (ie - placing code directly in Program.cs as a series of top level statements).

codecadwallader commented 2 years ago

Thanks for reporting the issue. If CodeMaid is unable to build a code model it will indeed show a blank or largely blank section. An example of this is shared projects which are not supported by the APIs we use.

We have not added support for global usings and some of the other new C# 9/10 features yet, so it seems very likely that may be the cause. A good starting point for adding support would be to take one of those files through the debugger and see how they are represented by the API as well as to confirm they are recognized by the EnvDTE CodeModel APIs we use.

wojciechsura commented 2 years ago

Maybe it would be a good idea to leave some information in the Spade window? Empty results are always confusing, I think it's better to explicitly notify, that outline generation failed. You could also leave a note why (maybe even a callstack as well? it may help in debugging and extending the extension).