View Issue Details

IDProjectCategoryView StatusLast Update
0003902NoesisGUIUnity3Dpublic2025-01-21 10:43
ReporterKeldorKatarn Assigned Tosfernandez  
PrioritynormalSeveritycrashReproducibilityalways
Status assignedResolutionopen 
Product Version3.2.5 
Target Version3.2.8 
Summary0003902: Accessing AdornerLayer in derived AdornerDecorator causes crash
DescriptionI have the following class. Accessing the AdornerLayer causes the crash

public class DialogAdornerDecorator : AdornerDecorator
    {
        private readonly DialogHost _dialogHost = new();

        public DialogAdornerDecorator()
        {
            AddVisualChild(_dialogHost);
        }

        /// <summary>Gets the <see cref="Visual"/> children count.</summary>
        protected override int VisualChildrenCount
        {
            get
            {
                return base.VisualChildrenCount == 0 ? 0 : base.VisualChildrenCount + 1;
            }
        }

#if UNITY_5_5_OR_NEWER
        private AdornerLayer AdornerLayer
        {
            get
            {
                return GetAdornerLayer();
            }
        }
#endif

        /// <inheritdoc/>
        protected override Size ArrangeOverride(Size finalSize)
        {
            base.ArrangeOverride(finalSize);
            var finalSizeRect = new Rect(finalSize);

            _dialogHost.Arrange(finalSizeRect);

            return finalSize;
        }

        /// <inheritdoc/>
        protected override Visual GetVisualChild(int index)
        {
            if (Child == null)
            {
                throw new ArgumentOutOfRangeException(nameof(index));
            }

            switch (index)
            {
                case 0:
                    return Child;

                case 1:
                    return AdornerLayer;

                case 2:
                    return _dialogHost;

                default:
                    throw new ArgumentOutOfRangeException(nameof(index));
            }
        }

        /// <inheritdoc/>
        protected override Size MeasureOverride(Size constraint)
        {
            var desiredSize = base.MeasureOverride(constraint);

            _dialogHost.Measure(constraint);

            return desiredSize;
        }
    }
TagsNo tags attached.
PlatformAny

Activities

KeldorKatarn

KeldorKatarn

2025-01-15 13:56

reporter   ~0010272

Additional note:

Even if I let AdornerLayer return null, using this decorator and then using the Tab key causes a crash as well. Not sure why

Issue History

Date Modified Username Field Change
2025-01-15 13:53 KeldorKatarn New Issue
2025-01-15 13:56 KeldorKatarn Note Added: 0010272
2025-01-21 10:43 sfernandez Assigned To => sfernandez
2025-01-21 10:43 sfernandez Status new => assigned
2025-01-21 10:43 sfernandez Target Version => 3.2.8