character-map-uwp / Character-Map-UWP

A modern, native UWP replacement for the Win32 Character Map and Windows Font Viewer with flawless high DPI and touch support.
MIT License
633 stars 54 forks source link

Cannot copy a character #331

Closed United600 closed 5 months ago

United600 commented 6 months ago

On a couple of languages (pt-PT and zh-CN) trying to copy a character throws this error. Both, as of right now, are the most complete translations.

Object reference not set to an instance of an object.
   at CharacterMap.Core.Utils.<TryCopyToClipboardInternalAsync>g__TrySetClipboard|13_0(String, String, FontMapViewModel, CopyDataType, IRandomAccessStream) + 0x251
   at CharacterMap.Core.Utils.<TryCopyToClipboardInternalAsync>d__13.MoveNext() + 0x78
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0x70
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task) + 0x38
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task) + 0x17
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult() + 0xf
   at CharacterMap.Views.FontMapView.<TryCopyInternal>d__46.MoveNext() + 0xcd
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__7_0(Object) + 0x1e
   at System.Action`1.Invoke(T) + 0x28
   at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore() + 0x33

Exception thrown at this line (with debugger attached) https://github.com/character-map-uwp/Character-Map-UWP/blob/0ebdcf0f2e61cc522a000d1a5047196eaaf406c1/CharacterMap/CharacterMap/Core/Utils.cs#L160

https://github.com/character-map-uwp/Character-Map-UWP/assets/698155/507d0edf-8ca7-4942-ab4d-77b8c34a790e

Exception thrown
JohnnyWestlake commented 6 months ago

should be is { } p instead of is var p to not throw, but also it shouldn't be changing depending on language 🤔 I'll look over the weekend.