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
Insert methods into an interface declaration with SyntaxGenerator.InsertMembers
The methods are added, but the public and static modifiers are stripped from the SyntaxTree giving a different meaning to the generated code.
Sorry I did create a minimal solution, but I found the line that I suspect causes modifiers to be stripped in case of adding to an interface declaration:
I can understand the behavior, in the context of C# not supporting this prior to version 8, but shouldn't this be a supported scenario now?
The other consideration is whether or not changing the behavior will impact existing use cases. Have to consider existing customers may be depending on this behavior. Not sure that we can safely change this.
Version Used: 4.4.0
Steps to Reproduce:
Sorry I did create a minimal solution, but I found the line that I suspect causes modifiers to be stripped in case of adding to an interface declaration:
roslyn/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs
Line 775 in b1b8636
I can understand the behavior, in the context of C# not supporting this prior to version 8, but shouldn't this be a supported scenario now?
Does anyone see a workaround?
Expected Behavior:
Code to be generated as:
Actual Behavior:
The text was updated successfully, but these errors were encountered: