Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using RichTextBox control with right-aligned bullets on Windows 11 24H2 #12592

Open
Nora-Zhou01 opened this issue Dec 5, 2024 · 7 comments
Assignees
Labels
Customer-reported external-OS-issue Issue caused by an external OS component such as Common Controls. untriaged The team needs to look at this issue in the next triage

Comments

@Nora-Zhou01
Copy link
Member

Nora-Zhou01 commented Dec 5, 2024

.NET version

10.0.100-alpha.1.24573.1

Did it work in .NET Framework?

Yes

Did it work in any of the earlier releases of .NET Core or .NET 5+?

No, repro in .NET 8.0

Issue description

Error using RichTextBox control with right-aligned bullets on Windows 11 24H2

Windows 11 Enterprise 24H2

24H2.mp4

.NET 10 (.NET 9.0 with the same results)

Image

.NET 8

Image

Windows 11 Enterprise 23H2

23H2.mp4

Steps to reproduce

  1. Create a Winforms .Net Core application and add RichTextBox and Button controls
  2. Set the Text of the RichTextBox to test
  3. Double-click the Button and add the following code
this.richTextBox1.Text = "test";

richTextBox1.RightToLeft = RightToLeft.Yes;

richTextBox1.SelectionBullet = true;
  1. Run the project on both Windows 11 23H2 and 24H2

Or

  1. Launch the WinFormsApp5.zip project
  2. Run the project on both Windows 11 23H2 and 24H2

More Info:
The issue is from customer feedback ticket: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2316184

@Nora-Zhou01 Nora-Zhou01 added external-OS-issue Issue caused by an external OS component such as Common Controls. untriaged The team needs to look at this issue in the next triage and removed external-OS-issue Issue caused by an external OS component such as Common Controls. labels Dec 5, 2024
@sohailaboebs
Copy link

I have almost the same issue, below is a description of what I had:
I am using Windows 11 and Microsoft Visual Studio to [C# Windows Forms] applications
I have a RichTextBox control that has rich text inside it
After updating to Windows 11 [24H2] I had an issue with filling the rich text box with text, below are the steps that cause the issue:

Start Visual Studio[Microsoft Visual Studio Community 2022 (64-bit) - Current]
Create a Windows Forms Application and Use .Net 8.0
Add a rich text box to the form
Add a button and put the code below in the button event handler:
private void button2_Click(object sender, EventArgs e)
{
this.richTextBox1.Text = “This is a test”;
richTextBox1.RightToLeft = RightToLeft.Yes;
richTextBox1.SelectionBullet = true;
}
You will get the exception below:
System.AccessViolationException: ‘Attempted to read or write protected memory. This is often an indication that other memory is corrupt.’
Rolling back to [23H2] clears this issue, please solve this bug

For my issue it looks like something went wrong when my Windows 11 updated to "Windows 11 [24H2]", almost on the same day or around it Visual Studio also had an update, one of these updates caused this issue, rolling back to "Windows 11 [23H2]" cleared this issue, the issue is related to the update, I am using [.Net 8.0] and I am using [Windows Forms and C#]
Thank you

@merriemcgaw
Copy link
Member

merriemcgaw commented Dec 11, 2024

@Nora-Zhou01 , does this happen in Framework on the same Win11 builds? Is there a .NET release where it did work? We'd also like to see if this happens in MFC apps. Is there other formatting where this has the exception (numbered, bold, italics) ?

@merriemcgaw merriemcgaw added the 📭 waiting-author-feedback The team requires more information from the author label Dec 11, 2024
@Nora-Zhou01
Copy link
Member Author

Nora-Zhou01 commented Dec 13, 2024

@Nora-Zhou01 , does this happen in Framework on the same Win11 builds?
Is there a .NET release where it did work? We'd also like to see if this happens in MFC apps. Is there other formatting where this has the exception (numbered, bold, italics) ?

Does not repro in the same Win11 24H2 version of the Framework and MFC project. The issue does not repro when setting other formats of the RichTextBox. I tried VS2019 16.5 and this issue still repro.

@dotnet-policy-service dotnet-policy-service bot removed the 📭 waiting-author-feedback The team requires more information from the author label Dec 13, 2024
@merriemcgaw
Copy link
Member

@LeafShi1 can your team investigate any differences in how we interact with the MFC control between NetFX and Core, or between MFC and Core? That should point us in the right direction.

@merriemcgaw
Copy link
Member

@Nora-Zhou01 I want to confirm that you aren't seeing this on earlier versions of Win11 just the latest?

@Tanya-Solyanik Tanya-Solyanik added the external-OS-issue Issue caused by an external OS component such as Common Controls. label Jan 8, 2025
@Nora-Zhou01
Copy link
Member Author

@Nora-Zhou01 I want to confirm that you aren't seeing this on earlier versions of Win11 just the latest?

This issue only occurs in win11 24h2 OS, and other versions do not reproduce

@LeafShi1
Copy link
Member

LeafShi1 commented Jan 13, 2025

@LeafShi1 can your team investigate any differences in how we interact with the MFC control between NetFX and Core, or between MFC and Core? That should point us in the right direction.

There is no difference between the way NetFX and Core interact with MFC controls, except for the way messages are sent.
Core uses PInvokeCore.SendMessage(this, PInvokeCore.EM_SETPARAFORMAT, 0, ref pf);
And NetFX uses UnsafeNativeMethods.SendMessage(new HandleRef(this, base.Handle), 1095, 0, pARAFORMAT);
But this is not the cause of this issue.

And the property SelectionBullet itself has no problem. This issue must be reproduced by setting richTextBox1.RightToLeft = RightToLeft.Yes; and then setting richTextBox1.SelectionBullet = true; and in win11 24h2 OS.
In the MFC project, RichTextBox does not have a property corresponding to RightToLeft, so this issue cannot be reproduced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Customer-reported external-OS-issue Issue caused by an external OS component such as Common Controls. untriaged The team needs to look at this issue in the next triage
Projects
None yet
Development

No branches or pull requests

5 participants