From f98cd1f7acdeed6067d1c18af7494c01299f2ecc Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Thu, 7 May 2026 11:43:29 +0200 Subject: [PATCH] Migrate macOS project to official Microsoft.Maui.Platforms.MacOS packages Replace the community Platform.Maui.MacOS packages (v0.3.0) with the official Microsoft.Maui.Platforms.MacOS packages (v0.1.0-preview.8.26256.5). Package changes: Microsoft.Maui.Platforms.MacOS Microsoft.Maui.Platforms.MacOS.BlazorWebView Microsoft.Maui.Platforms.MacOS.Essentials 10.0.41 (required dependency) Namespace changes: Microsoft.Maui.Platforms.MacOS.Platform Microsoft.Maui.Platforms.MacOS.Hosting Microsoft.Maui.Platforms.MacOS.Handlers Microsoft.Maui.Platforms.MacOS.Controls Microsoft.Maui.Platforms.MacOS.Essentials Adds Info.plist with NSBluetoothAlwaysUsageDescription. This is required because Microsoft.Maui.DevFlow.Agent (v0.1.0-preview.7.26230.1) uses CoreBluetooth (CBCentralManager) for device discovery. Without this key, macOS crashes the app on startup with a TCC privacy violation. This affects any Debug build using the current DevFlow agent version regardless of which macOS platform package is used. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/MauiSherpa.MacOS/BlazorContentPage.cs | 6 +++--- src/MauiSherpa.MacOS/Info.plist | 8 ++++++++ src/MauiSherpa.MacOS/InspectorPage.cs | 4 ++-- src/MauiSherpa.MacOS/MacOSApp.cs | 6 +++--- src/MauiSherpa.MacOS/MacOSMauiProgram.cs | 6 +++--- src/MauiSherpa.MacOS/MauiMacOSApp.cs | 3 ++- src/MauiSherpa.MacOS/MauiSherpa.MacOS.csproj | 12 ++++++------ 7 files changed, 27 insertions(+), 18 deletions(-) create mode 100644 src/MauiSherpa.MacOS/Info.plist diff --git a/src/MauiSherpa.MacOS/BlazorContentPage.cs b/src/MauiSherpa.MacOS/BlazorContentPage.cs index 090653bb..08a728e0 100644 --- a/src/MauiSherpa.MacOS/BlazorContentPage.cs +++ b/src/MauiSherpa.MacOS/BlazorContentPage.cs @@ -1,6 +1,6 @@ using Microsoft.Maui.Controls; -using Microsoft.Maui.Platform.MacOS; -using Microsoft.Maui.Platform.MacOS.Controls; +using Microsoft.Maui.Platforms.MacOS.Platform; +using Microsoft.Maui.Platforms.MacOS.Controls; using MauiSherpa.Core.Interfaces; using AppKit; using CoreGraphics; @@ -278,7 +278,7 @@ private void SetupSidebarWidthPersistence() // BlazorContentPage -> NavigationPage (Detail) -> FlyoutPage var navPage = this.Parent as NavigationPage; var flyoutPage = navPage?.Parent as FlyoutPage; - var handler = flyoutPage?.Handler as Microsoft.Maui.Platform.MacOS.Handlers.NativeSidebarFlyoutPageHandler; + var handler = flyoutPage?.Handler as Microsoft.Maui.Platforms.MacOS.Handlers.NativeSidebarFlyoutPageHandler; var splitVC = handler?.SplitViewController; var splitView = splitVC?.SplitView; if (splitView == null) return; diff --git a/src/MauiSherpa.MacOS/Info.plist b/src/MauiSherpa.MacOS/Info.plist new file mode 100644 index 00000000..360bb5c1 --- /dev/null +++ b/src/MauiSherpa.MacOS/Info.plist @@ -0,0 +1,8 @@ + + + + + NSBluetoothAlwaysUsageDescription + MAUI Sherpa uses Bluetooth to detect device connectivity status. + + diff --git a/src/MauiSherpa.MacOS/InspectorPage.cs b/src/MauiSherpa.MacOS/InspectorPage.cs index 45d50463..db952d82 100644 --- a/src/MauiSherpa.MacOS/InspectorPage.cs +++ b/src/MauiSherpa.MacOS/InspectorPage.cs @@ -1,6 +1,6 @@ using Microsoft.Maui.Controls; -using Microsoft.Maui.Platform.MacOS; -using Microsoft.Maui.Platform.MacOS.Controls; +using Microsoft.Maui.Platforms.MacOS.Platform; +using Microsoft.Maui.Platforms.MacOS.Controls; namespace MauiSherpa; diff --git a/src/MauiSherpa.MacOS/MacOSApp.cs b/src/MauiSherpa.MacOS/MacOSApp.cs index 9fb8d0d9..26691b96 100644 --- a/src/MauiSherpa.MacOS/MacOSApp.cs +++ b/src/MauiSherpa.MacOS/MacOSApp.cs @@ -1,5 +1,5 @@ using Microsoft.Maui.Controls; -using Microsoft.Maui.Platform.MacOS; +using Microsoft.Maui.Platforms.MacOS.Platform; using MauiSherpa.Core.Interfaces; using AppKit; using Foundation; @@ -91,7 +91,7 @@ private void SaveState() var splitView = _cachedSplitView; if (splitView == null) { - var handler = _flyoutPage?.Handler as Microsoft.Maui.Platform.MacOS.Handlers.NativeSidebarFlyoutPageHandler; + var handler = _flyoutPage?.Handler as Microsoft.Maui.Platforms.MacOS.Handlers.NativeSidebarFlyoutPageHandler; splitView = handler?.SplitViewController?.SplitView; } if (splitView != null) @@ -116,7 +116,7 @@ private void SaveState() internal void CacheSplitView() { if (_cachedSplitView != null) return; - var handler = _flyoutPage?.Handler as Microsoft.Maui.Platform.MacOS.Handlers.NativeSidebarFlyoutPageHandler; + var handler = _flyoutPage?.Handler as Microsoft.Maui.Platforms.MacOS.Handlers.NativeSidebarFlyoutPageHandler; _cachedSplitView = handler?.SplitViewController?.SplitView; } diff --git a/src/MauiSherpa.MacOS/MacOSMauiProgram.cs b/src/MauiSherpa.MacOS/MacOSMauiProgram.cs index e759f498..f3ad89da 100644 --- a/src/MauiSherpa.MacOS/MacOSMauiProgram.cs +++ b/src/MauiSherpa.MacOS/MacOSMauiProgram.cs @@ -4,9 +4,9 @@ using MauiSherpa.Core.ViewModels; using MauiSherpa.Core.Interfaces; using MauiSherpa.Core.Services; -using Microsoft.Maui.Platform.MacOS.Hosting; -using Microsoft.Maui.Platform.MacOS.Handlers; -using Microsoft.Maui.Essentials.MacOS; +using Microsoft.Maui.Platforms.MacOS.Hosting; +using Microsoft.Maui.Platforms.MacOS.Handlers; +using Microsoft.Maui.Platforms.MacOS.Essentials; using Shiny.Mediator; using Sentry.Maui; #if DEBUG diff --git a/src/MauiSherpa.MacOS/MauiMacOSApp.cs b/src/MauiSherpa.MacOS/MauiMacOSApp.cs index 9fbd979f..44f26540 100644 --- a/src/MauiSherpa.MacOS/MauiMacOSApp.cs +++ b/src/MauiSherpa.MacOS/MauiMacOSApp.cs @@ -1,7 +1,8 @@ using AppKit; using Foundation; using Microsoft.Maui.Hosting; -using Microsoft.Maui.Platform.MacOS.Hosting; +using Microsoft.Maui.Platforms.MacOS.Hosting; +using Microsoft.Maui.Platforms.MacOS.Platform; namespace MauiSherpa; diff --git a/src/MauiSherpa.MacOS/MauiSherpa.MacOS.csproj b/src/MauiSherpa.MacOS/MauiSherpa.MacOS.csproj index e42f96d5..9221a233 100644 --- a/src/MauiSherpa.MacOS/MauiSherpa.MacOS.csproj +++ b/src/MauiSherpa.MacOS/MauiSherpa.MacOS.csproj @@ -26,9 +26,9 @@ - - - + + + @@ -37,7 +37,7 @@ - + @@ -93,7 +93,7 @@ - @@ -109,7 +109,7 @@