Skip to content

[macOS]Build may fail if the title contains a slash #33462

@koszeggy

Description

@koszeggy

Description

After upgrading from .NET 8 to .NET 10, the build of one of my MAUI test apps started to fail on MacOS with a DirectoryNotFoundException (other targets work):

Details
KGySoft.Drawing.Examples.SkiaSharp.Maui net10.0-maccatalyst maccatalyst-x64 failed with 1 error(s) (1,7s) → bin/Debug/net10.0-maccatalyst/maccatalyst-x64/KGySoft.Drawing.Examples.SkiaSharp.Maui.dll
    /usr/local/share/dotnet/packs/Microsoft.MacCatalyst.Sdk.net10.0_26.2/26.2.10191/tools/msbuild/Xamarin.Shared.targets(2566,3): error MSB4018: 
      The "ComputeCodesignItems" task failed unexpectedly.
      System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/username/kgysoft/KGySoft.Drawing/Examples/SkiaSharp.Maui/bin/Debug/net10.0-maccatalyst/maccatalyst-x64/KGy SOFT Drawing SkiaSharp/KGy SOFT Drawing SkiaSharp/MAUI Example.app'.
         at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
         at System.IO.Enumeration.FileSystemEnumerator`1.Init()
         at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
         at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options)
         at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions enumerationOptions)
         at Xamarin.MacDev.Tasks.ComputeCodesignItems.EnumerateAppBundleEntries(String appPath)+MoveNext() in /Users/builder/azdo/_work/2/s/macios/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeCodesignItems.cs:line 247
         at Xamarin.MacDev.Tasks.ComputeCodesignItems.FindFilesToSign(String appPath) in /Users/builder/azdo/_work/2/s/macios/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeCodesignItems.cs:line 300
         at Xamarin.MacDev.Tasks.ComputeCodesignItems.Execute() in /Users/builder/azdo/_work/2/s/macios/msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeCodesignItems.cs:line 115
         at Microsoft.Build.BackEnd.TaskExecutionHost.Execute()
         at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)

After spending many hours with narrowing the issue down, it turned out that the problem is that the <ApplicationTitle> contained a slash character, which is not escaped when generating the output content.

Steps to Reproduce

Add a '/' character to the title. Example:

<ApplicationTitle>My SkiaSharp/MAUI Example</ApplicationTitle>

Link to public reproduction project repository

https://github.com/koszeggy/KGySoft.Drawing/tree/master/Examples/SkiaSharp.Maui

Version with bug

10.0.20

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

.NET 8 (Please specify exact version)

Affected platforms

macOS

Affected platform versions

macOS 26, net10.0-maccatalyst, Microsoft.Maui.Controls 10.0.20

Did you find any workaround?

An alternative title can be specified for macOS conditionally:

<!-- Display name (note: macOS does not tolerate '/' in the title lately) -->
<ApplicationTitle Condition="'$(TargetFramework)' != 'net10.0-maccatalyst'">KGy SOFT Drawing SkiaSharp/MAUI Example</ApplicationTitle>
<ApplicationTitle Condition="'$(TargetFramework)' == 'net10.0-maccatalyst'">KGy SOFT Drawing SkiaSharp-MAUI Example</ApplicationTitle>

Relevant log output

Open the collapsible Details section in Description above

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform/macosmacOS / Mac Catalysts/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions