You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Within the Microsoft.VisualStudio.SDK package is the EnvDTE80 assembly. Inside it there are interfaces like CodeFunction2 that allow for an access modifier to be set (e.g. function.Access = vsCMAccess.Public). This used to work as expected for several years, but as I upgraded my extension CodeMaid to use v16.10.31321.278 of this package for VS2022 support it now has negative side effects to the code.
Here's an example:
namespace BugRepro
{
public class Class1
{
#if DEBUG
[Obsolete]
#endif
uint A(uint b) => b;
}
}
If you attempt to set the access modifier on the method A it will delete the #endif line of code. Originally reported here: codecadwallader/codemaid#879
There have been several other issues reported too that we've traced back to attempting to set the access modifiers. It is affecting methods, properties, structs, etc. I can provide more examples if it would be helpful.
Thanks for looking into it and please let me know if there's any way I can be of help!
The text was updated successfully, but these errors were encountered:
If this eventually bubbles down into syntaxgenerator, it's likely that something is forgeting to call 'Isolate' to ensure it's manipulating a node, independent of surrounding trivia.
@codecadwaller is there any chance you can move off of codemodel? it's effectively on life-support for us, with very iffy views on how it can even survive potential large scale future architectural changes. The information it provides is already available through the roslyn APIs (which can be used in a safe fashion in the BG as immutable snapshot). And it's much cleaner to try to mutate C#/VB directly using roslyn vs going through codemodel.
@CyrusNajmabadi I have investigated a rewrite of CodeMaid to Roslyn several times, but it is a very large under-taking without a clear migration path. I know Roslyn is a hands-down improvement and it's what I wished for back in 2007 when I started with the CodeModel APIs, but unfortunately we've got a lot of CodeModel and RegEx based logic. We also support C++ which isn't a part of Roslyn to my knowledge.
Routed from microsoft/VSExtensibility#74
Within the Microsoft.VisualStudio.SDK package is the EnvDTE80 assembly. Inside it there are interfaces like CodeFunction2 that allow for an access modifier to be set (e.g. function.Access = vsCMAccess.Public). This used to work as expected for several years, but as I upgraded my extension CodeMaid to use v16.10.31321.278 of this package for VS2022 support it now has negative side effects to the code.
Here's an example:
namespace BugRepro
{
public class Class1
{
#if DEBUG
[Obsolete]
#endif
uint A(uint b) => b;
}
}
If you attempt to set the access modifier on the method A it will delete the #endif line of code. Originally reported here: codecadwallader/codemaid#879
There have been several other issues reported too that we've traced back to attempting to set the access modifiers. It is affecting methods, properties, structs, etc. I can provide more examples if it would be helpful.
Thanks for looking into it and please let me know if there's any way I can be of help!
The text was updated successfully, but these errors were encountered: