Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with MAX_PATH #15042

Closed
Kebechet opened this issue May 11, 2023 · 13 comments
Closed

Problem with MAX_PATH #15042

Kebechet opened this issue May 11, 2023 · 13 comments
Assignees
Labels
area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging partner/platform-tools Client Experiences Platform Tools t/bug Something isn't working

Comments

@Kebechet
Copy link

Kebechet commented May 11, 2023

Description

I am on Windows and I build my iOS application through connected Mac M1 mini.

I have spotted an error on package MauiMTAdmob that provides Google ads. It uses bindings around native libraries and the xcframework folder structure is quite deep.
The package name is xamarin.firebase.ios.core v8.10.0.3

When I want to build my app with this package and run in in iOS simulator it ends with error. Basically the content of this package cant be moved to the remote MAC. The cause is probably the long path but even after setting up

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
"LongPathsEnabled"=dword:00000001

in my registries, nothing changed.

I have googled possible workarounds and all of them just tries to shorten the final path. Either by specifying nuget folder to:
C:\nuget\ by specifying environment variables NUGET_PACKAGES and NUGET_PATH, moving whole project closer to the root directory or other similar things.

Issues related to this problem:

Steps to Reproduce

Run on Windows and have connected remote MAC

  1. restore all packages
  2. connect to MAC
  3. Press Run in simulator
  4. Program fail with errors

Link to public reproduction project repository

https://github.com/Kebechet/MauiPathProblem/commits/main

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

I was not able test on other platforms

Affected platform versions

Windows 11 Pro - 10.0.22621

Did you find any workaround?

No, none of mentioned workarounds worked for me

Relevant log output

1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7054\targets\Xamarin.Shared.Sdk.targets(2014,3): error : MessagingRemoteException: An error occurred on client Build1647054 while executing a reply for topic xvs/build/16.4.7054/execute-task/PathMauiApp/8b5ca10002fGetFileSystemEntries

1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7054\targets\Xamarin.Shared.Sdk.targets(2014,3): error : DirectoryNotFoundException: Could not find a part of the path '/Users/marcopoloooo/Library/Caches/Xamarin/mtbs/builds/PathMauiApp/8b5ca1011c9ff81f5d26fa18099764f025c8f0bc3da589484bd28c7653d3e937/C:/nuget/xamarin.firebase.ios.core/8.10.0.3/lib/net6.0-ios15.4/Firebase.Core.resources'.

1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7054\targets\Xamarin.Shared.Sdk.targets(2014,3): error :

1>Done building project "PathMauiApp.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
@Kebechet Kebechet added the t/bug Something isn't working label May 11, 2023
@mattleibow
Copy link
Member

@rolfbjarne @dalexsoto thoughts?

@rolfbjarne
Copy link
Member

This is for XMA, CC @emaf

@samhouts samhouts added area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging partner/platform-tools Client Experiences Platform Tools labels May 12, 2023
@scriptBoris
Copy link

Need to find fix on maximum path length for Windows 11

@mattleibow
Copy link
Member

I do not think it is max path as this path is 220 and is an invalid path entirely:

/Users/marcopoloooo/Library/Caches/Xamarin/mtbs/builds/PathMauiApp/8b5ca1011c9ff81f5d26fa18099764f025c8f0bc3da589484bd28c7653d3e937/C:/nuget/xamarin.firebase.ios.core/8.10.0.3/lib/net6.0-ios15.4/Firebase.Core.resources'

Take not of the C:/ right in the middle of the path on mac - and the : means a path splitter. So this path is basically 2 paths in one. It is wrong in all forms of the error.

There is probably a bug in XMA or in the nuget targets file.

@scriptBoris
Copy link

scriptBoris commented May 19, 2023

I do not think it is max path as this path is 220 and is an invalid path entirely:

/Users/marcopoloooo/Library/Caches/Xamarin/mtbs/builds/PathMauiApp/8b5ca1011c9ff81f5d26fa18099764f025c8f0bc3da589484bd28c7653d3e937/C:/nuget/xamarin.firebase.ios.core/8.10.0.3/lib/net6.0-ios15.4/Firebase.Core.resources'

Take not of the C:/ right in the middle of the path on mac - and the : means a path splitter. So this path is basically 2 paths in one. It is wrong in all forms of the error.

There is probably a bug in XMA or in the nuget targets file.

image

I don't think this is a problem since the test project runs just fine.

  1. Folder C/ and all dependencies are created
  2. Folder C/ is created, but folders with dependencies cannot be installed

@scriptBoris
Copy link

I do not think it is max path as this path is 220 and is an invalid path entirely:

/Users/marcopoloooo/Library/Caches/Xamarin/mtbs/builds/PathMauiApp/8b5ca1011c9ff81f5d26fa18099764f025c8f0bc3da589484bd28c7653d3e937/C:/nuget/xamarin.firebase.ios.core/8.10.0.3/lib/net6.0-ios15.4/Firebase.Core.resources'

Take not of the C:/ right in the middle of the path on mac - and the : means a path splitter. So this path is basically 2 paths in one. It is wrong in all forms of the error.

There is probably a bug in XMA or in the nuget targets file.

I did some research and decided that C:/ is the real problem

@emaf
Copy link
Contributor

emaf commented May 19, 2023

@scriptBoris @Kebechet Could you share a build binary log with us? You can get one using the Project System Tools extension for Visual Studio. You can find more information about thow to use it here. With this log we should be able to find out why the file was not copied over to the Mac.

Some comments about the path:

  • The length should not be an issue because that path is built on macOS, so Windows should never hit that problem
  • C:/ is valid, or at least it's something we've been using for a long time already

@scriptBoris
Copy link

scriptBoris commented May 19, 2023

@scriptBoris @Kebechet Could you share a build binary log with us? You can get one using the Project System Tools extension for Visual Studio. You can find more information about thow to use it here. With this log we should be able to find out why the file was not copied over to the Mac.

Some comments about the path:

  • The length should not be an issue because that path is built on macOS, so Windows should never hit that problem
  • C:/ is valid, or at least
    it's something we've been using for a long time already

Take it
TipTronicMaui_Debug_AnyCPU_Build_2023-05-19T22_21_25.4669383+06_00.zip

This problem should be mark as MOST IMPORTANT. Because google firebase now used on multiple batle projects 🥲

@scriptBoris
Copy link

@emaf is there a solution to the problem?

@emaf
Copy link
Contributor

emaf commented May 23, 2023

@scriptBoris Thanks for providing the logs! We've already identified the root cause of the problem and we are currently working on a fix.

cc @rolfbjarne

@brunck
Copy link
Contributor

brunck commented May 23, 2023

Looks like this is being tracked in xamarin/xamarin-macios#18308.

@rolfbjarne
Copy link
Member

Can you try removing the SessionId property in your local file Xamarin.Shared.Sdk.targets file for the GetFileSystemEntries task and see if that works around the problem?

So remove this line:

https://github.com/rolfbjarne/xamarin-macios/blob/7e3297578111dedbf4f7041f8a40bc4285b49fd8/dotnet/targets/Xamarin.Shared.Sdk.targets#L1902

So that the task looks like this:

<GetFileSystemEntries
	DirectoryPath="@(_BindingPackagesFromReferencedAssembliesDirectoriesExists)"
	Pattern="*"
	Recursive="true"
	IncludeDirectories="false"
	>
	<Output TaskParameter="Entries" ItemName="_BindingPackagesFromReferencedAssemblies" />
</GetFileSystemEntries>

Note that you might have to restart Visual Studio for the change to take effect.

@rolfbjarne rolfbjarne self-assigned this May 24, 2023
rolfbjarne added a commit to xamarin/xamarin-macios that referenced this issue May 25, 2023
… to the Mac. (#18324)

Make the GetFileSystemEntries task capable of copying files to the Mac, and
enable this new behavior when inspecting references for binding resources.

Otherwise the task might not find anything, if the files aren't copied to the
Mac (this happens if the files originate from NuGets instead of referenced
projects).

Ref:

* https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1808448 (third attempt)
* #18308
* dotnet/maui#15042
@rolfbjarne
Copy link
Member

Closing as duplicate of xamarin/xamarin-macios#18308.

@rolfbjarne rolfbjarne closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-tooling XAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debugging partner/platform-tools Client Experiences Platform Tools t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants