Hi support,
I think I found an issue with the default behavior of Telerik UI for Winforms on a HighDPI PerMonitorV2 configuration.
The application works correctly and resizes well if moved between screen with different Font Scalings.
However, if the user changes the main screen to one with a different scaling, the application is strangely taking the change into account and would also not come back to its original state.
Attached is a GIF showing the problem and the project. The application on run on screen 3 being main display at 100% FontScale. If I pass Screen 1, the main display (which is 125% font scaled), the icons of the app are made larger (for no reason), going back to screen 1 being the main screen, will not restore the icon to the correct size, unless you make parts of the application being redrawn.
I've a more related question but it's more complex and I won't be able to provide a project for this, so I'm just trying here ;) In our real application (not this test one), when setting PerMonitorV2 mode, we need to have RadControl.EnableRadAutoScale set to false for the controls to resize correctly when changing monitors whereas this [test] application needs it to be let it set to true to kind of do the same thing ?! Any idea on where the difference can come from ?
Thanks & regards,
Benjamin Foucher
KeyNotFoundException in DefaultAppearanceProvider.TryGetCurrentAnnotationAppearances when loading PDF with FreeText/Widget annotation containing invalid "/AP << /N 0 0 R >>" reference (likely macOS Preview-authored)
Loading a PDF containing an annotation with a broken appearance reference (/AP << /N 0 0 R >> — an indirect reference to object 0, which is reserved/invalid per the PDF spec) throws an unhandled KeyNotFoundException deep inside the rendering pipeline when the affected page is scrolled into view. This crashes the hosting WPF application, since the exception originates inside WPF's layout/render callback (OnRender) rather than during the initial PdfFormatProvider.Import() call, so it cannot be caught by application-level try/catch around import.
I found this appears to match a previously reported and fixed issue: "PdfViewer: KeyNotFoundException is thrown when loading a document with Free Text Annotation," fixed in Release 2024.3.924. I'd like confirmation this is the same root cause and whether 2024.3.924+ resolves it, or if this is a distinct case given the specific /N 0 0 R malformation I've isolated.
RadPdfViewer via PdfFormatProvider.Import() with ImportSettings = PdfImportSettings.ReadOnDemand.RadFixedDocument to RadPdfViewer.Document.System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Telerik.Windows.Documents.Fixed.Model.Annotations.MultiStateAppearances.get_Item(String stateName)
at Telerik.Windows.Documents.Fixed.Utilities.Rendering.Annotations.DefaultAppearanceProvider.TryGetCurrentAnnotationAppearances(Annotation annotation, SingleStateAppearances& singleStateAppearances)
at Telerik.Windows.Documents.Fixed.Utilities.Rendering.Annotations.DefaultAppearanceProvider.TryProvideAppearanceOverride(Annotation annotation, AnnotationAppearanceMode annotationAppearanceMode, FormSource& formSource)
at Telerik.Windows.Documents.Fixed.Utilities.Rendering.Annotations.BaseAppearanceProvider.TryProvideAppearance(Annotation annotation, AnnotationAppearanceMode annotationAppearanceMode, FormSource& appearance)
at Telerik.Windows.Documents.Fixed.Utilities.Rendering.Annotations.BaseAppearanceProvider.TryProvideAppearance(Annotation annotation, AnnotationAppearanceMode annotationAppearanceMode, FormSource& appearance)
at Telerik.Windows.Documents.Fixed.Utilities.Rendering.FixedPageContentRenderingHelper.RenderNormalAnnotationAppearance(IFixedContentRenderer renderer, Annotation annotation)
at Telerik.Windows.Documents.Fixed.UI.AnnotationAppearancesCanvas.DrawAppearance(DrawingContext drawingContext)
at Telerik.Windows.Documents.Fixed.UI.AnnotationAppearancesCanvas.OnRender(DrawingContext dc)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.Controls.Canvas.ArrangeOverride(Size arrangeSize)
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)The offending annotation object in the PDF:
181 0 obj
<< /AP << /N 0 0 R >>
/M (D:20231128120931Z00'00')
/Rect [ 67.664 412.788 527.774 446.2222 ]
/AAPL:SFF true
/F 4
/DA (//Menlo-Regular 14 Tf 0 g)
/AAPL:AKExtras
<< /AAPL:AKPDFAnnotationDictionary
<< /AP << /N 0 0 R >>
.../AP << /N 0 0 R >> is an indirect reference to object number 0, which is reserved by the PDF spec (head of the free-object list) and never resolves to a real object./AAPL:SFF, /AAPL:AKExtras, /AAPL:AKPDFAnnotationDictionary keys indicate this annotation was written by macOS Preview.app (Apple's proprietary annotation/markup extensions), consistent with a document that was signed or markup-annotated on a Mac before being distributed.DefaultAppearanceProvider.TryGetCurrentAnnotationAppearances does: singleStateAppearances = appearances[appearances.CurrentState];with no existence/null check before indexing — when CurrentState doesn't resolve to a valid key (because the backing /N reference was never a valid object), this throws KeyNotFoundException uncaught.
This exception occurs during WPF's internal render callback, outside the call stack of the code that calls PdfFormatProvider.Import(), so it cannot be caught by a standard try/catch around import/load. It surfaces as a DispatcherUnhandledException on the UI thread and, without an application-level workaround, crashes the hosting application entirely.
/N 0 0 R invalid-reference pattern?/N 0 0 R malformation, not just the FreeText-annotation case?Appearances/MultiStateAppearances members, which is fragile across versions.)TryGetCurrentAnnotationAppearances already has "Try" in its name implying safe failure, could this be hardened with a TryGetValue instead of the indexer, to fail gracefully rather than throw, for any similarly malformed future document?When is the Microsoft.Web.Webview2 issue expected to be resolved?
Even after adding in the Microsoft.Web.WebView2 1.0.4078.44 nuget dependency to my project, as suggested here: https://feedback.telerik.com/winforms/1714837-radpdfviewer-could-not-load-microsoft-web-webview2-winforms-in-q2-2026, I get a runtime exception because WebView2 is targeting .NET 10 10.0.0.17763.10 and my .NET 10 version is 10.0.201.
Should I downgrade to earlier version of Telerik UI for WPF or is there another workaround?
The Telerik dependencies I'm using are as follows:
Telerik.Windows.Controls.for.Wpf.Xaml.2026.2.701
Telerik.Windows.Controls.Data.for.Wpf.Xaml.2026.2.701
Telerik.Windows.Controls.Diagrams.for.Wpf.Xaml.2026.2.701
Telerik.Windows.Controls.Docking.for.Wpf.Xaml.2026.2.701
Telerik.Windows.Controls.FileDialogs.for.Wpf.Xaml.2026.2.701
Telerik.Windows.Controls.GridView.for.Wpf.Xaml.2026.2.701
Telerik.Windows.Controls.Navigation.for.Wpf.Xaml.2026.2.701