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

RichTextBox: Copy to Clipboard throws NotSupportedException #579

Closed
jbe2277 opened this issue Apr 13, 2019 · 2 comments
Closed

RichTextBox: Copy to Clipboard throws NotSupportedException #579

jbe2277 opened this issue Apr 13, 2019 · 2 comments
Assignees
Labels
Bug Product bug (most likely) regression status: This issue is a regression from a previous build or release
Milestone

Comments

@jbe2277
Copy link

jbe2277 commented Apr 13, 2019

  • .NET Core SDK: 3.0.100-preview5-011256 [e6f157e5a4]
  • Microsoft.WindowsDesktop.App 3.0.0-preview5-27610-56
  • VS 2019: 16.1.0 Preview 1.0
  • Windows version: Win10 1809 (Azure VM, connected via Remote Desktop)
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: No

Copy to Clipboard (e.g. press Ctrl+C) within the RichTextBox throws a NotSupportedException with the message: No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.

Reproduce:

  • Clone https://github.com/jbe2277/waf.git
  • Checkout the netcoreapp3.0 branch
  • Open System.Waf.sln in VS 2019.
  • Set Samples/Writer/Writer.Presentation as start-up project
  • Start the application and click on New.
  • Insert some text, select the text and press Ctrl + C.

Expected: The selected text should be copied to the Clipboard. You could compare this with the master branch (targets .NET 4.6.1)

Actual: The application crashes.

Related issue: I get the same exception when I try to save the RichTextBox content as RTF file. Just press Save in the Writer application.

Details: Copy to Clipboard throws the exception:

System.NotSupportedException
  HResult=0x80131515
  Message=No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
  Source=System.Private.CoreLib
  StackTrace:
   at System.Text.Encoding.GetEncoding(Int32 codepage) in F:\workspace\_work\1\s\src\System.Private.CoreLib\shared\System\Text\Encoding.cs:line 287

System.Private.CoreLib.dll!System.Text.Encoding.GetEncoding(int codepage) Line 287
PresentationFramework.dll!System.Windows.Documents.FontTableEntry.ComputePreferredCodePage()
PresentationFramework.dll!System.Windows.Documents.XamlToRtfWriter.XamlToRtfWriter(string xaml)
PresentationFramework.dll!System.Windows.Documents.XamlRtfConverter.ConvertXamlToRtf(string xamlContent)
PresentationFramework.dll!System.Windows.Documents.TextEditorCopyPaste._CreateDataObject(System.Windows.Documents.TextEditor This, bool isDragDrop)
PresentationFramework.dll!System.Windows.Documents.TextEditorCopyPaste.Copy(System.Windows.Documents.TextEditor This, bool userInitiated)
PresentationCore.dll!System.Windows.Input.CommandBinding.OnExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
PresentationCore.dll!System.Windows.Input.CommandManager.ExecuteCommandBinding(object sender, System.Windows.Input.ExecutedRoutedEventArgs e, System.Windows.Input.CommandBinding commandBinding)
PresentationCore.dll!System.Windows.Input.CommandManager.FindCommandBinding(object sender, System.Windows.RoutedEventArgs e, System.Windows.Input.ICommand command, bool execute)
PresentationCore.dll!System.Windows.Input.CommandManager.OnExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target)
PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised)
PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args)
PresentationCore.dll!System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs args)
PresentationCore.dll!System.Windows.Input.RoutedCommand.ExecuteImpl(object parameter, System.Windows.IInputElement target, bool userInitiated)
PresentationCore.dll!System.Windows.Input.CommandManager.TranslateInput(System.Windows.IInputElement targetElement, System.Windows.Input.InputEventArgs inputEventArgs)
PresentationCore.dll!System.Windows.UIElement.OnKeyDownThunk(object sender, System.Windows.Input.KeyEventArgs e)
PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target)
PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised)
PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args)
PresentationCore.dll!System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs args)
PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea()
PresentationCore.dll!System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport inputReport)
PresentationCore.dll!System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(ref System.Windows.Interop.MSG msg, ref bool handled)
PresentationCore.dll!System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(ref System.Windows.Interop.MSG msg, System.Windows.Input.ModifierKeys modifiers)
PresentationCore.dll!System.Windows.Interop.HwndSource.OnPreprocessMessage(object param)
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler)
WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs)
PresentationCore.dll!System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(ref System.Windows.Interop.MSG msg, ref bool handled)
WindowsBase.dll!System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(ref System.Windows.Interop.MSG msg)
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame)
PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore)
PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window)
Writer.dll!Waf.Writer.Presentation.App.Main()
@ryalanms ryalanms added the Bug Product bug (most likely) label Apr 13, 2019
@stevenbrix stevenbrix added this to the 3.0 milestone Apr 18, 2019
@grubioe grubioe added this to Needs Triage in .NET Core 3.0 May 10, 2019
@rladuca rladuca added the regression status: This issue is a regression from a previous build or release label May 20, 2019
@grubioe
Copy link
Contributor

grubioe commented May 24, 2019

Triage: @ojhad - can you look into this one? You looked at something similar before. Thanks!

@ojhad
Copy link
Contributor

ojhad commented Jul 6, 2019

Merged PR with fix, closed issue.

@ghost ghost locked as resolved and limited conversation to collaborators Apr 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Product bug (most likely) regression status: This issue is a regression from a previous build or release
Projects
No open projects
.NET Core 3.0
Needs Triage
Development

No branches or pull requests

6 participants