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 (2) #1424

Closed
jbe2277 opened this issue Jul 28, 2019 · 3 comments
Closed

RichTextBox: Copy to Clipboard throws NotSupportedException (2) #1424

jbe2277 opened this issue Jul 28, 2019 · 3 comments

Comments

@jbe2277
Copy link

jbe2277 commented Jul 28, 2019

Reopen of #579 as the bug seems not to be solved. I have retested it with this version:

  • .NET Core SDK: 3.0.100-preview7-012821
  • VS 2019: 16.2.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:

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()
@rladuca
Copy link
Member

rladuca commented Jul 28, 2019

This should be fixed in the latest nightly builds see #664 .

Can you give those a try and let us know if it still reproduces?

@rladuca rladuca added the 📭 waiting-author-feedback To request more information from author. label Jul 28, 2019
@jbe2277
Copy link
Author

jbe2277 commented Jul 29, 2019

I tried it with the latest SDK. Now it seems to work. Thanks for the fix.

Used SDK version:

Version:   3.0.100-preview8-013602
Commit:    1249356c7a

@rladuca
Copy link
Member

rladuca commented Jul 29, 2019

Great! Closing accordingly.

@rladuca rladuca closed this as completed Jul 29, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Apr 15, 2022
@dipeshmsft dipeshmsft removed the 📭 waiting-author-feedback To request more information from author. label Aug 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants