Skip to content

[Bug]: Unexpected behavior when commenting out code in AXAML file. #203

Open

Description

@astroman133

Describe the bug

I have a simple view with a Button nested inside a StackPanel. When I select only the starting element of the StackPanel and execute the Comment Selection command via either Ctrl+K, Ctrl+C or by Edit | Advanced | Comment Selection, the entire StackPanel with all the nested content is selected.

This behavior differs from VS 2026 with a WPF project and is undesirable.

To Reproduce

Create an Avalonia UserControl and add a StackPanel control to the xml with a nested Button inside the StackPanel.

Swipe across the opening element of the StackPanel to select the opening bracket to the closing bracket at the end of the same line.

Comment the selection.

Notice that the ending xml comment is placed at the end of the StackPanel's end tag rather than at the end of the selection.

See the attached screenshot below.

If I then select the Button element and uncomment it the markup becomes littered with start and end comment tags. This is not the desired behavior.

You can never do wrong by doing what the user requested. If that is not what they wanted, then it is their fault, not yours!

Thanks,

Rick B

Product(s)

Avalonia for Visual Studio

Platform

Windows

License Tier

Community

Avalonia version

No response

Tool/Control Version

Avalonia for Visual Studio extension version 12.3.2.0

Relevant log output

Additional context

Image

Notice that only text on line 9 is selected, but the end comment is added at the end of line 13.

Activity

  1. added theissue type on Oct 1, 2026
  2. mrlacey commented on Oct 1, 2026

    @mrlacey
    Contributor

    Good find. This isn't behaving as it should.
    It will be fixed in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions