Element
: NRE by accessing RealParent
#23320
Labels
area-controls-general
General issues that span multiple controls, or common base classes such as View or Element
fixed-in-8.0.70
fixed-in-9.0.0-preview.7.24407.4
p/1
Work that is important, and has been scheduled for release in this or an upcoming sprint
platform/android 🤖
platform/iOS 🍎
platform/macOS 🍏
macOS / Mac Catalyst
platform/tizen
Samsung Tizen Devices (TV)
platform/windows 🪟
s/triaged
Issue has been reviewed
s/verified
Verified / Reproducible Issue ready for Engineering Triage
t/bug
Something isn't working
Milestone
Description
Running
LayoutBenchmarker
reports aNullReferenceException
.Steps to Reproduce
and I can observe in the output:
The problem is here:
maui/src/Controls/src/Core/Element/Element.cs
Lines 397 to 403 in 45a8686
The issue seems to be that
RealParent
is de factoWeakReference<Element>
and as such checking for null here is not sufficient to avoid an NRE.Link to public reproduction project repository
No response
Version with bug
Nightly / CI build (Please specify exact version)
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Windows, I was not able test on other platforms
Affected platform versions
No response
Did you find any workaround?
I added
var realParent = RealParent;
and the benchmark finished OK.Relevant log output
No response
The text was updated successfully, but these errors were encountered: