Files
ZeroSpace/.junie/plans/make-map-editor-work-on-windows.md
T

17 KiB

sessionId
sessionId
session-260928-112553-atgt

Delivery Steps

* Step 1: Implementation

<plan_session_history> History processor: During the current session, you have worked on the following <previous_issue>. The <issue_description> usually continues or extends your previous work. Consider all <previous_issue> and <issue_description> together. If <assistant_question>/<user_answer> blocks are present, treat them as additional user-provided context that may contain important clarifications about the task. <previous_issue>

Plan Task

Make the ZeroSpace.MapEditor project work on Windows PC </previous_issue> <previous_issue_solution> tool name: submit tool parameters:

  • "delivery_plan"=[{"description":"The ZeroSpace.MapEditor.csproj file contains all necessary SDK references, target framework settings, and unpackaged WinUI configuration to target Windows desktop.\n\n- Update ZeroSpace/ZeroSpace.MapEditor/ZeroSpace.MapEditor.csproj to conditionally set TargetFrameworks (net10.0-windows10.0.19041.0 on Windows, net10.0-maccatalyst on other platforms).\n- Add package reference <PackageReference Include=\"Microsoft.Maui.Controls\" Version=\"$(MauiVersion)\" />.\n- Set <WindowsPackageType>None</WindowsPackageType> to enable unpackaged desktop execution without MSIX signing requirements.\n- Set <SupportedOSPlatformVersion> and <TargetPlatformMinVersion> for Windows to 10.0.17763.0.\n- Retain existing MAUI asset items (fonts, images) and ensure consistent single-project asset routing.","name":"Configure ZeroSpace.MapEditor project file and package references"},{"description":"The Platforms/Windows/ folder contains the required WinUI 3 application bootstrap and manifest files.\n\n- Create ZeroSpace/ZeroSpace.MapEditor/Platforms/Windows/App.xaml declaring the MauiWinUIApplication root with x:Class=\"ZeroSpace.MapEditor.WinUI.App\".\n- Create ZeroSpace/ZeroSpace.MapEditor/Platforms/Windows/App.xaml.cs initializing the WinUI application and overriding CreateMauiApp() to invoke MauiProgram.CreateMauiApp().\n- Create ZeroSpace/ZeroSpace.MapEditor/Platforms/Windows/app.manifest configuring DPI awareness (PerMonitorV2) and long-path support.\n- Ensure cross-platform compatibility files in Platforms/MacCatalyst/ (AppDelegate.cs, Info.plist, Program.cs) remain cleanly separated and intact.","name":"Add Windows platform host entry point and application manifests"},{"name":"Validate Windows build and map editor functionality","description":"The ZeroSpace.MapEditor project compiles cleanly on Windows and correctly loads star systems from zs.docs/StarSystem.\n\n- Build ZeroSpace.MapEditor targeting net10.0-windows10.0.19041.0 using dotnet build ZeroSpace\\ZeroSpace.MapEditor\\ZeroSpace.MapEditor.csproj.\n- Verify the solution build in ZeroSpace\\ZeroSpace.sln completes without errors or missing reference warnings.\n- Validate that MapEditorPage.xaml.cs runtime directory resolution (TryAutoLoad and folder picker) successfully resolves the zs.docs\\StarSystem markdown star system files."}],
  • "name"="make-map-editor-work-on-windows",
  • "proposal"=[{"name":"Requirements","content":"### Overview & Goals\nThe ZeroSpace.MapEditor project is a .NET MAUI desktop tool intended for editing galactic war star systems and celestial maps backed by Markdown frontmatter in the zs.docs repository folder. Currently, the project lacks Windows platform configuration and host files, preventing it from compiling and launching on a Windows PC. The goal of this change is to configure ZeroSpace.MapEditor so it builds and runs smoothly on Windows desktop as an unpackaged WinUI application.\n\n### Scope\n- In Scope:\n - Updating ZeroSpace/ZeroSpace.MapEditor/ZeroSpace.MapEditor.csproj to include Windows target framework (net10.0-windows10.0.19041.0), <WindowsPackageType>None</WindowsPackageType>, and the required Microsoft.Maui.Controls package reference.\n - Adding WinUI 3 host bootstrap files in Platforms/Windows/ (App.xaml, App.xaml.cs, app.manifest).\n - Ensuring the application can be built and launched with dotnet run / Rider on Windows without MSIX package signing hurdles.\n - Verifying compatibility of the existing file loading (zs.docs/StarSystem) and UI rendering on Windows desktop.\n- Out of Scope:\n - Modifying the core map editing business logic or parser in MapEditorPage.xaml.cs.\n - MSIX store packaging or code signing pipelines.\n - Changes to other projects in the solution (ZeroSpace.Web, ZeroSpace.ApiService, etc.).\n\n### User Stories\n- As a developer on Windows, I want to compile and launch ZeroSpace.MapEditor directly using dotnet run or JetBrains Rider, so that I can edit star system maps without switching operating systems.\n- As a map designer, I want the map editor on Windows to automatically locate the repository's zs.docs/StarSystem folder and permit folder picking, so that I can inspect and edit star system nodes.\n\n### Functional Requirements\n- ZeroSpace.MapEditor must compile successfully on Windows PC targeting net10.0-windows10.0.19041.0.\n- Launching the app on Windows must display the MapEditorPage with full interactive canvas rendering (drawing star systems, nodes, and connections).\n- Auto-loading of star systems (TryAutoLoad) must correctly locate zs.docs\\StarSystem when traversing upward from the Windows execution directory.\n- The folder picker dialog must function on Windows desktop when browsing for custom directories.\n\n### Non-Functional Requirements\n- Build Performance: Fast incremental build without requiring external Mac/iOS workloads when building on Windows.\n- Packaging Simplicity: Uses unpackaged desktop mode (WindowsPackageType=None) so no MSIX developer certs or installation steps are necessary.\n- Clean Architecture: Follows standard .NET MAUI single-project structure with platform-specific code isolated under Platforms/.\n"},{"name":"Technical Design","content":"### Current Implementation\nThe ZeroSpace.MapEditor project currently consists of:\n- ZeroSpace.MapEditor.csproj: A basic MAUI project file targeting net10.0-maccatalyst17.0 and net10.0-windows10.0.19041.0, but missing the <PackageReference Include=\"Microsoft.Maui.Controls\" Version=\"$(MauiVersion)\" /> package reference and <WindowsPackageType>None</WindowsPackageType>.\n- App.xaml & App.xaml.cs: MAUI application markup and code-behind.\n- MauiProgram.cs: MAUI app builder configuring fonts (OpenSans-Regular, OpenSans-Semibold).\n- MapEditorPage.xaml & MapEditorPage.xaml.cs: Canvas-based map rendering and Markdown parser for star system documents.\n- Platforms/MacCatalyst/: Contains AppDelegate.cs, Info.plist, and Program.cs.\n- Platforms/Windows/: Missing entirely. WinUI 3 requires MauiWinUIApplication in App.xaml / App.xaml.cs and an app.manifest.\n\n### Key Decisions\n1. Unpackaged WinUI Application (WindowsPackageType=None):\n - Decision: Configure ZeroSpace.MapEditor as an unpackaged desktop application.\n - Rationale: Packaged MSIX applications require signing certificates, package deployment registration, and virtualized file system redirection that can complicate accessing repo-relative markdown files. Unpackaged mode allows direct standard .exe execution and simple dotnet run workflows.\n2. Conditional Target Frameworks:\n - Decision: Target net10.0-windows10.0.19041.0 when building on Windows ($([MSBuild]::IsOSPlatform('windows'))) and net10.0-maccatalyst on non-Windows.\n - Rationale: Prevents build failures or warnings on Windows when Mac/iOS workloads or SDKs are not installed, while preserving cross-platform developer support.\n3. WinUI Application Host Class in Platforms/Windows/:\n - Decision: Add Platforms/Windows/App.xaml and Platforms/Windows/App.xaml.cs inheriting from MauiWinUIApplication in namespace ZeroSpace.MapEditor.WinUI.\n - Rationale: Standard WinUI 3 entry point required by .NET MAUI to host the WinUI application lifecycle on Windows.\n\n### Proposed Changes\n\n#### 1. Update ZeroSpace.MapEditor.csproj\nxml\n<Project Sdk=\"Microsoft.NET.Sdk\">\n\n\t<PropertyGroup>\n\t\t<TargetFrameworks Condition=\"$([MSBuild]::IsOSPlatform('windows'))\">net10.0-windows10.0.19041.0</TargetFrameworks>\n\t\t<TargetFrameworks Condition=\"!$([MSBuild]::IsOSPlatform('windows'))\">net10.0-maccatalyst</TargetFrameworks>\n\t\t<OutputType>Exe</OutputType>\n\t\t<RootNamespace>ZeroSpace.MapEditor</RootNamespace>\n\t\t<UseMaui>true</UseMaui>\n\t\t<SingleProject>true</SingleProject>\n\t\t<ImplicitUsings>enable</ImplicitUsings>\n\t\t<Nullable>enable</Nullable>\n\n\t\t<ApplicationTitle>ZeroSpace Map Editor</ApplicationTitle>\n\t\t<ApplicationId>ca.jonathanmccaffrey.zerospace.mapeditor</ApplicationId>\n\t\t<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>\n\t\t<ApplicationVersion>1</ApplicationVersion>\n\n\t\t<!-- Unpackaged Windows desktop execution -->\n\t\t<WindowsPackageType>None</WindowsPackageType>\n\n\t\t<SupportedOSPlatformVersion Condition=\"$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'\">10.0.17763.0</SupportedOSPlatformVersion>\n\t\t<TargetPlatformMinVersion Condition=\"$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'\">10.0.17763.0</TargetPlatformMinVersion>\n\t</PropertyGroup>\n\n\t<ItemGroup>\n\t\t<PackageReference Include=\"Microsoft.Maui.Controls\" Version=\"$(MauiVersion)\" />\n\t</ItemGroup>\n\n</Project>\n\n\n#### 2. Add Platforms/Windows/App.xaml\nxml\n<maui:MauiWinUIApplication\n x:Class=\"ZeroSpace.MapEditor.WinUI.App\"\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n xmlns:maui=\"using:Microsoft.Maui\"\n xmlns:local=\"using:ZeroSpace.MapEditor.WinUI\">\n\n</maui:MauiWinUIApplication>\n\n\n#### 3. Add Platforms/Windows/App.xaml.cs\ncsharp\nusing Microsoft.UI.Xaml;\n\nnamespace ZeroSpace.MapEditor.WinUI;\n\npublic partial class App : MauiWinUIApplication\n{\n\tpublic App()\n\t{\n\t\tthis.InitializeComponent();\n\t}\n\n\tprotected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();\n}\n\n\n#### 4. Add Platforms/Windows/app.manifest\nxml\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<assembly manifestVersion=\"1.0\" xmlns=\"urn:schemas-microsoft-com:asm.v1\">\n <assemblyIdentity version=\"1.0.0.0\" name=\"ZeroSpace.MapEditor.WinUI.app\"/>\n <application xmlns=\"urn:schemas-microsoft-com:asm.v3\">\n <windowsSettings>\n <dpiAware xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">true/PM</dpiAware>\n <dpiAwareness xmlns=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\">PerMonitorV2, PerMonitor</dpiAwareness>\n <longPathAware xmlns=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\">true</longPathAware>\n </windowsSettings>\n </application>\n</assembly>\n\n\n### File Structure\n\nZeroSpace/ZeroSpace.MapEditor/\n├── App.xaml\n├── App.xaml.cs\n├── AppShell.xaml (if added)\n├── MauiProgram.cs\n├── MapEditorPage.xaml\n├── MapEditorPage.xaml.cs\n├── ZeroSpace.MapEditor.csproj [Modified]\n├── Platforms/\n│ ├── MacCatalyst/\n│ │ ├── AppDelegate.cs\n│ │ ├── Info.plist\n│ │ └── Program.cs\n│ └── Windows/ [New Directory]\n│ ├── App.xaml [New File]\n│ ├── App.xaml.cs [New File]\n│ └── app.manifest [New File]\n└── Resources/\n ├── AppIcon/\n ├── Fonts/\n ├── Images/\n ├── Raw/\n └── Splash/\n\n\n### Architecture Diagram\nmermaid\ngraph TD\n subgraph WindowsDesktop[\"Windows Desktop Host\"]\n WinExe[\"ZeroSpace.MapEditor.exe\"] --> WinApp[\"Platforms/Windows/App (MauiWinUIApplication)\"]\n end\n\n subgraph MauiCore[\"MAUI Shared Layer\"]\n WinApp --> MauiProg[\"MauiProgram.CreateMauiApp()\"]\n MauiProg --> App[\"App.xaml.cs\"]\n App --> MapEditorPage[\"MapEditorPage.xaml.cs (Canvas & Editor)\"]\n end\n\n subgraph DataStorage[\"File System (zs.docs)\"]\n MapEditorPage -->|TryAutoLoad / FolderPicker| DocsFolder[\"zs.docs/StarSystem/*.md\"]\n end\n\n\n### Risks & Mitigations\n- Risk: Missing Windows SDK or WinUI workload components on the development machine.\n - Mitigation: The project targets net10.0-windows10.0.19041.0 and references standard Microsoft.Maui.Controls which is already included in .NET MAUI SDK on Windows.\n- Risk: Path separator differences when parsing star system markdown files on Windows (\\ vs /).\n - Mitigation: MapEditorPage.xaml.cs utilizes Path.Combine and Directory.GetParent, which natively handle Windows directory separators.\n"},{"content":"### Validation Approach\nVerification will be performed by building the project with the .NET SDK / MSBuild and testing the map editor loading flow on Windows desktop.\n\n### Key Scenarios\n1. Clean Project Compilation:\n - Run dotnet build ZeroSpace\\ZeroSpace.MapEditor\\ZeroSpace.MapEditor.csproj -f net10.0-windows10.0.19041.0.\n - Verify build completes with 0 errors and 0 warnings.\n2. Solution Build Compatibility:\n - Run dotnet build ZeroSpace\\ZeroSpace.sln.\n - Verify all projects in the solution build cleanly together.\n3. Star System Auto-Loading on Windows:\n - Verify TryAutoLoad() in MapEditorPage.xaml.cs resolves zs.docs\\StarSystem from the project's bin directory on Windows without throwing DirectoryNotFoundException.\n4. Desktop UI Window Launch:\n - Verify the application initializes the main window and renders the star system graph canvas.\n\n### Edge Cases\n- Missing MacCatalyst Workload on Windows: Verify that building on Windows does not attempt to compile the MacCatalyst target or fail due to missing Apple SDKs.\n- Long Path Names in zs.docs: Verify app.manifest enables longPathAware so long file paths in zs.docs are supported without truncation.\n","name":"Testing"}] </previous_issue_solution> <previous_issue>

Orchestrated Plan Task

implement according to the plan </previous_issue> <previous_issue_solution>

Summary

  • Enabled ZeroSpace.MapEditor to build for Windows as an unpackaged .NET MAUI WinUI app and completed the planned Windows host setup.
  • Resolved remaining Windows compatibility blockers so the project and full solution now build cleanly on Windows.

Changes

  • Updated ZeroSpace.MapEditor.csproj with conditional Windows/Mac target frameworks, WindowsPackageType=None, Windows min/supported OS versions, and required MAUI/CommunityToolkit package references.
  • Added Platforms/Windows/App.xaml, App.xaml.cs, and app.manifest for the WinUI host bootstrap, DPI awareness, and long-path support.
  • Fixed Windows build blockers by switching app startup to CreateWindow(...) and wiring folder picking through CommunityToolkit.Maui.Storage in MapEditorPage.xaml.cs.

Verification

  • Verified dotnet build ZeroSpace\ZeroSpace.MapEditor\ZeroSpace.MapEditor.csproj -f net10.0-windows10.0.19041.0 succeeds with 0 warnings and 0 errors.
  • Verified dotnet build ZeroSpace\ZeroSpace.sln succeeds with 0 warnings and 0 errors; confirmed TryAutoLoad upward traversal reaches zs.docs\StarSystem from the Windows build output path.

Notes

  • GUI launch/canvas interaction and live folder-picker interaction were not exercised in this headless environment, but the produced Windows build is clean and the path-resolution logic was independently confirmed. </previous_issue_solution> <previous_issue>

Plan Task

System.TypeLoadException: Method 'get_HasExplicitSafeAreaEdges' in type 'Microsoft.Maui.Controls.Page' from assembly 'Microsoft.Maui.Controls, Version=10.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation. at Microsoft.Maui.Controls.Hosting.AppHostBuilderExtensions.RemapForControls(MauiAppBuilder builder) at Microsoft.Maui.Controls.Hosting.AppHostBuilderExtensions.RemapForControls(MauiAppBuilder builder) at Microsoft.Maui.Controls.Hosting.AppHostBuilderExtensions.SetupDefaults(MauiAppBuilder builder) at Microsoft.Maui.Controls.Hosting.AppHostBuilderExtensions.UseMauiPrimaryApp[TApp](MauiAppBuilder builder) at Microsoft.Maui.Controls.Hosting.AppHostBuilderExtensions.UseMauiApp[TApp](MauiAppBuilder builder) at ZeroSpace.MapEditor.MauiProgram.CreateMauiApp() in C:\Users\jonmc\ZeroSpace\ZeroSpace\ZeroSpace.MapEditor\MauiProgram.cs:line 8 at ZeroSpace.MapEditor.WinUI.App.CreateMauiApp() in C:\Users\jonmc\ZeroSpace\ZeroSpace\ZeroSpace.MapEditor\Platforms\Windows\App.xaml.cs:line 12 at Microsoft.Maui.MauiWinUIApplication.OnLaunched(LaunchActivatedEventArgs args) at Microsoft.UI.Xaml.Application.Microsoft.UI.Xaml.IApplicationOverrides.OnLaunched(LaunchActivatedEventArgs args) at ABI.Microsoft.UI.Xaml.IApplicationOverrides.Do_Abi_OnLaunched_0(IntPtr thisPtr, IntPtr args) </previous_issue> <previous_issue_solution> tool name: submit tool parameters: </previous_issue_solution> </plan_session_history>

<plan_task> implement according to the plan </plan_task>

This task has no prior planning phase. Before implementation, analyze the task and codebase, define acceptance criteria if not explicitly provided in the task description, and plan your approach. The Reviewer must independently define its own acceptance criteria and will verify them.