Don't run the editing shortcuts in a read-only composer - #3373
Open
FrayxRulez wants to merge 1 commit into
Open
Conversation
Enter without Shift wrote a vertical tab into the document, which RichEdit rejects with E_ACCESSDENIED whenever the composer has been made read-only because the user cannot post in the chat. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UnauthorizedAccessException— "Access is denied. (Exception from HRESULT: 0x80070005)" — reported by crash telemetry on 12.9.1.0.Cause
ChatViewmakes the composer read-only whenever the user cannot post —chat.Permissions.CanSendBasicMessages is falseand friends — while leaving it visible and focusable.FormattedTextBox.OnKeyDownnever looked atIsReadOnly, so with send-by-Enter off, a plain Enter took the "insert a vertical tab instead of a hard paragraph" path and calledDocument.Selection.SetTexton a document the app itself had write-protected. RichEdit returnsE_ACCESSDENIEDfromITextRange::SetTextin that state, and the marshaller turns it into an exception.Pressing Enter in any chat you can't post in is enough to reproduce it.
Every other branch of that
switch— the emoji-aware Backspace/Delete, redo, the formatting toggles, Ctrl+K, Alt+X — mutates the document the same way and had the same hole.Change
One early-out at the top of
FormattedTextBox.OnKeyDown: whenIsReadOnly, defer to the base implementation and skip the shortcuts, which is what the class already does at its otherIsReadOnlyguards. RichEdit ignores its own editing shortcuts on a read-only document, so nothing that used to work stops working.Not built: no UWP/.NET Native toolchain here.
CSharpSyntaxTree.ParseTexton the edited file reports no diagnostics — that confirms it still parses, and nothing more.🤖 Generated with Claude Code