Repository: AvaloniaUI/Avalonia
File: src/Avalonia.Native/TopLevelImpl.cs (C#)

Code before:

    private Size _savedLogicalSize;
    private double _savedScaling;
    private WindowTransparencyLevel _transparencyLevel = WindowTransparencyLevel.None;

    protected MacOSTopLevelHandle? _handle;

    private object _syncRoot = new object();
    private IEnumerable<object>? _surfaces;

    public TopLevelImpl(IAvaloniaNativeFactory factory)
    {
        Factory = factory;

        _keyboard = AvaloniaLocator.Current.GetService<IKeyboardDevice>();
        _mouse = new MouseDevice();
        _pen = new PenDevice();
        _cursorFactory = AvaloniaLocator.Current.GetService<ICursorFactory>();
    }

    internal virtual void Init(MacOSTopLevelHandle handle)
    {
        _handle = handle;
        _savedLogicalSize = ClientSize;
        _savedScaling = Native?.Scaling ?? 1;
        ;
        _nativeControlHost = new NativeControlHostImpl(Native!.CreateNativeControlHost());
        _platformBehaviorInhibition = new PlatformBehaviorInhibition(Factory.CreatePlatformBehaviorInhibition());
        _surfaces = new object[] { new GlPlatformSurface(Native), new MetalPlatformSurface(Native), this };
        InputMethod = new AvaloniaNativeTextInputMethod(Native);
    }

    internal void BeginDraggingSession(AvnDragDropEffects effects, AvnPoint point, IAvnClipboard clipboard, IAvnDndResultCallback callback, IntPtr sourceHandle)
    {
        Native?.BeginDragAndDropOperation(effects, point, clipboard, callback, sourceHandle);
    }

    public double DesktopScaling => 1;

    public IAvnTopLevel? Native => _handle?.Native;
    public IPlatformHandle? Handle => _handle;
    public AvaloniaNativeTextInputMethod? InputMethod { get; protected set; }
    public Size ClientSize
    {
        get
        {
            if (Native == null)
            {
                return default;
            }


Review comment (suggestion):
```suggestion
        _savedScaling = Native?.Scaling ?? 1;
```

Code after:

    private Size _savedLogicalSize;
    private double _savedScaling;
    private WindowTransparencyLevel _transparencyLevel = WindowTransparencyLevel.None;

    protected MacOSTopLevelHandle? _handle;

    private object _syncRoot = new object();
    private IEnumerable<object>? _surfaces;

    public TopLevelImpl(IAvaloniaNativeFactory factory)
    {
        Factory = factory;

        _keyboard = AvaloniaLocator.Current.GetService<IKeyboardDevice>();
        _mouse = new MouseDevice();
        _pen = new PenDevice();
        _cursorFactory = AvaloniaLocator.Current.GetService<ICursorFactory>();
    }

    internal virtual void Init(MacOSTopLevelHandle handle)
    {
        _handle = handle;
        _savedLogicalSize = ClientSize;
        _savedScaling = Native?.Scaling ?? 1;
        _nativeControlHost = new NativeControlHostImpl(Native!.CreateNativeControlHost());
        _platformBehaviorInhibition = new PlatformBehaviorInhibition(Factory.CreatePlatformBehaviorInhibition());
        _surfaces = new object[] { new GlPlatformSurface(Native), new MetalPlatformSurface(Native), this };
        InputMethod = new AvaloniaNativeTextInputMethod(Native);
    }

    internal void BeginDraggingSession(AvnDragDropEffects effects, AvnPoint point, IAvnClipboard clipboard, IAvnDndResultCallback callback, IntPtr sourceHandle)
    {
        Native?.BeginDragAndDropOperation(effects, point, clipboard, callback, sourceHandle);
    }

    public double DesktopScaling => 1;

    public IAvnTopLevel? Native => _handle?.Native;
    public IPlatformHandle? Handle => _handle;
    public AvaloniaNativeTextInputMethod? InputMethod { get; protected set; }
    public Size ClientSize
    {
        get
        {
            if (Native == null)
            {
                return default;
            }

            var s = Native.ClientSize;