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

Clicking "Options" on CodeMaid menu won't work and shows a message error popup #906

Open dprevato opened 2 years ago

dprevato commented 2 years ago

Environment

Steps to recreate

Simply, choose CodeMaid -> Options on the Extensions menu

Current behavior

The only thing I see is the messagebox with the error

Expected behavior

I expect to see the Options menu

dprevato commented 2 years ago

FYI, the very same messagebox appears also when I click on the "About.." menu item; if I click on the item "Spade" I obtain a messagebox with a different error message: "Exception has been thrown by the target of an invocation". I have the suspect that this strange behavior depends on some other settings of mine (or else you'd have a bunch of issues :) ), but I've been using CodeMaid for years with the same Visual Studio configuration (ReSharper, Mads Kristensen extensions), and the problem came only when I updated Visual Studio to 2022 version. The only new extensions that I've installed with Visual Studio 2022 are SuperCharger and PostSharp.

codecadwallader commented 2 years ago

Thanks for reporting the issue. Starting with VS2022 we had to introduce an explicit initialization of the ResourceAssembly that was not required in the past. Some details here: https://github.com/codecadwallader/codemaid/issues/816#issuecomment-937761603

I am not sure how that setting works if there are other extensions that are attempting to do the same thing. Out of curiosity if you disable other extensions do you still get the same warning? Do any other the other extensions show a similar warning when CodeMaid is enabled?

dprevato commented 2 years ago

Please pardon me, I'm late; I have to say that CodeMaid is the only extension that has this behavior; the extension works like always, but I can't open the options dialog, the About and the Spade.

codecadwallader commented 2 years ago

Ok, it's helpful to know that other extensions do not have the same issue. If you disable other extensions do you still get the same warning in CodeMaid?

alessandroparma commented 2 years ago

Just for information. I have the same issue with the same error message. I have also supercharger installed on VS2022. If i remove (uninstall) supercharger, codemaid comes back to full work.

dprevato commented 2 years ago

I was testing CodeMaid without other extensions, and I finally find the workaround: if Visual Studio has no project loaded, CodeMaid works like a charm! I'm an happy man again, but this is still weird: it never happened until the latest version of Visual Studio 2019. The Options menu and the others had always worked even though solutions with hundreds of projects were loaded

doterik commented 2 years ago

Just for information. I have the same issue with the same error message. I have also supercharger installed on VS2022. If i remove (uninstall) supercharger, codemaid comes back to full work.

I experience exactly the same issue.

Supercharger and CodeMaid don't seem to work together. That is, CodeMaid stops working(*), Supercharger continues to work.

(*) Some functions work, but especially Spade doesn't.

image

dprevato commented 2 years ago

I have Supercharger installed on Visual Studio Community Edition, but I have also a copy of Visual Studio Enterprise Edition, licensed, without Supercharger. I have the problem in both of them, but when I have a project loaded Codemaid works, but I cannot change options; when Visual studio is blank, Codemaid works like a charm.

Il giorno dom 20 feb 2022 alle ore 12:46 doterik @.***> ha scritto:

Just for information. I have the same issue with the same error message. I have also supercharger installed on VS2022. If i remove (uninstall) supercharger, codemaid comes back to full work.

I experience exactly the same issue.

Supercharger and CodeMaid don't seem to work together. That is, CodeMaid stops working, Supercharger continues to work.

— Reply to this email directly, view it on GitHub https://github.com/codecadwallader/codemaid/issues/906#issuecomment-1046219164, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJFWFMOYPH423HXF5PNLI3U4DIBXANCNFSM5NTTSXQA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

BearintheWillows commented 2 years ago

I have this issue too. As @dprevato says, options works when there isn't a project open but shows the error message when trying to go in options with a project open.

codecadwallader commented 2 years ago

Thanks for all of the additional context. That's helpful to know about the workaround that it behaves prior to a solution being opened. I kind of doubt it is related to the solution, but does anyone have a minimal solution that exhibits the issue? It seems more likely that it would be environment related (e.g. version of .NET, other extensions, etc.).

One other thing that could be attempted is to enable CodeMaid's diagnostics mode (CodeMaid->Options->Diagnostics->Enable diagnostics mode). Since it's in the Options window it would have to be done while the solution is closed. This will drop detailed messages into the Output tool window under the CodeMaid pane. I don't know that this exception will surface there but there could be something else leading up to it that would be helpful.

codecadwallader commented 2 years ago

Cross link to #873

kellyethridge commented 2 years ago

I have the same issue while having MappingGenerator extension installed. I can access CodeMaid options when no solution is loaded still. I did the diagnostic output and it displayed "OptionsCommand.OnExecute invoked" when attempting to open the CodeMaid options.