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

VS paired to MAC throws MessagingRemoteException when a MAUI app is built for an iOS simulator #18308

Closed
AndreyMarten opened this issue May 22, 2023 · 37 comments
Labels
bug If an issue is a bug or a pull request a bug fix regression The issue or pull request is a regression
Milestone

Comments

@AndreyMarten
Copy link

Steps to Reproduce

  1. Pair VS for Windows to MAC;
  2. Add DevExpress Packages to the project (or use DX template)
  3. Select a target simulator device in the Build/Run selector;
  4. Try to build the application.

The issue did not occur before I upgraded Visual Studio to v17.6.


Expected Behavior

The application is built and it's possible to run the simulator to test the app.

Actual Behavior

A error is thrown:

MessagingRemoteException: An error occurred on client Build1647054 while executing a reply for topic xvs/build/16.4.7054/execute-task/DXMauiApp99/37bc554002fGetFileSystemEntries
DirectoryNotFoundException: Could not find a part of the path '/Users/macmini/Library/Caches/Xamarin/mtbs/builds/DXMauiApp99/37bc554f2c40df3a4c4b0f15c1028412e79eb9f56e7a3388355626fe86dd57cf/C:/Users/kunitsyn.andrey/.nuget/packages/devexpress.maui.charts/22.2.6/lib/net7.0-ios15.4/DevExpress.iOS.Charts.resources'.

Environment

Version information
Microsoft Visual Studio Professional 2022
Version 17.6.0
VisualStudio.17.Release/17.6.0+33712.159
Microsoft .NET Framework
Version 4.8.09032

Installed Version: Professional

Visual C++ 2022   00483-10801-57609-AA174
Microsoft Visual C++ 2022

ASP.NET and Web Tools   17.6.326.62524
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.6.326.62524
Azure App Service Tools v3.0.0

BusinessObjectEditor   1.0
Information about my package

C# Tools   4.6.0-3.23259.8+c3cc1d0ceeab1a65da0217e403851a1e8a30086a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

CreateLayoutWizard   1.0
Create layout wizard.

DevExpress Dashboard Extension   1.4
A Visual Studio extension that invokes the Dashboard Designer editor.

DevExpress Reporting Extension   1.4
A Visual Studio extension that invokes the Report Designer editor for report definition VSREPX files.

DevExpress Reporting Tools Extension   1.0
Extends Visual Studio with tools required for the Report Designer editor.

DevExpress VSDesigner NETFramework Package   1.0
A Visual Studio extension that invokes the Report and Dashboard designer editors.

DevExpress.DeploymentTool   1.0
A useful tool for deploying DevExpress assemblies.

DevExpress.ExpressApp.Design.DynamicPackage   1.0
DevExpress VSIX Package

DevExpress.ExpressApp.DesignPackage   1.0
DevExpress VSIX Package

DevExpress.Win.LayoutAssistant Extension   1.0
DevExpress.Win.LayoutAssistant Visual Studio Extension Detailed Info

Extensibility Message Bus   1.4.21 (main@8f226a8)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Mono Debugging for Visual Studio   17.6.41 (790a401)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   6.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core)   17.6.0.2326105+37f2727000f6a964584cafb86e69cf0b39baecb7
Provides languages services for ASP.NET Core Razor.

Syntax Visualizer   1.0
An extension for visualizing Roslyn SyntaxTrees.

TypeScript Tools   17.0.20329.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.6.0-3.23259.8+c3cc1d0ceeab1a65da0217e403851a1e8a30086a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.6.0-beta.23174.5+0207bea1afae48d9351ac26fb51afc8260de0a97
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

VSPackage Extension   1.0
VSPackage Visual Studio Extension Detailed Info

Xamarin   17.6.0.251 (d17-6@318364c)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   17.6.6.0 (remotes/origin/d17-6@cb430751d1)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   17.6.32 (98c12a2)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   13.2.0.6 (d17-5/a200af1)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: 6dd9def
    Java.Interop: xamarin/java.interop/d17-5@149d70fe
    SQLite: xamarin/sqlite/3.40.1@68c69d8
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@9f02d77


Xamarin.iOS and Xamarin.Mac SDK   16.4.0.6 (97731c92c)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Build Logs

Log file: build.binlog.txt

Please rename the file extension from txt to binlog - I had to change the extension as the Issue form does not allow to drop files with binlog extension.

Example Project (If Possible)

I did not attach a project as it will require DevExpress packages. If a project is essential to diagnose this behavior, please let me know.

@AndreyMarten
Copy link
Author

Just a short addition:

It looks like msbuild tries to get files using the /Users/macmini/Library/Caches/Xamarin/mtbs/builds/DXMauiApp99/37bc554f2c40df3a4c4b0f15c1028412e79eb9f56e7a3388355626fe86dd57cf/C:/Users/kunitsyn.andrey/.nuget/packages/devexpress.maui.charts/22.2.6/lib/net7.0-ios15.4/DevExpress.iOS.Charts.resources path.

However, there is no /Users/macmini/Library/Caches/Xamarin/mtbs/builds/DXMauiApp99/37bc554f2c40df3a4c4b0f15c1028412e79eb9f56e7a3388355626fe86dd57cf/C:/Users/kunitsyn.andrey/.nuget folder at all.

@rolfbjarne
Copy link
Member

We've fixed this already (#18287), and the fix will be in the next service releases.

@rolfbjarne rolfbjarne added this to the Future milestone May 22, 2023
@rolfbjarne rolfbjarne added the bug If an issue is a bug or a pull request a bug fix label May 22, 2023
@jadenrogers
Copy link

What's the time frame on the release? Days, weeks

@rolfbjarne
Copy link
Member

@jadenrogers weeks probably.

You can likely work around it by applying the fix locally - find the Xamarin.Shared.Sdk.targets file on your Windows machine, and change it according to the diff using a text editor: https://github.com/xamarin/xamarin-macios/pull/18287/files

@AidarNurmukhametov
Copy link

AidarNurmukhametov commented May 23, 2023

#18287 does not fix this. Condition="'$(IsMacEnabled)' == 'true'" is true in terms of this issue (VS paired to mac), so BuildSessionIdIfConnected is set to BuildSessionId, which is exactly the same behavior as before. Am I wrong? Tested this fix twice, nothing changed.

I think this is because of <_BindingPackagesFromReferencedAssembliesDirectoriesExists Include="@(_BindingPackagesFromReferencedAssembliesDirectoriesCandidates->Distinct())" Condition="Exists('%(Identity)')" /> (line 1882 at the moment). This checks if _BindingPackagesFromReferencedAssembliesDirectoriesCandidates exists, I suppose, but on local machine. There are no such folders on remote. So we need to copy that directories before this call. But it didn't happened

@rolfbjarne
Copy link
Member

@AidarNurmukhametov if you can reproduce this when IsMacEnabled=true, then please attach a binlog from such a build (in the build log provided in the description of this issue IsMacEnabled=false).

@DmitryRomenskiy
Copy link

Hi there,

Idk about the reasoning about why this happens, but can confirm that w/a does not work

@AidarNurmukhametov
Copy link

@rolfbjarne Hope this helps
build.binlog.txt

@rolfbjarne
Copy link
Member

rolfbjarne commented May 23, 2023

@AidarNurmukhametov can you try removing the SessionId property in your local Xamarin.Shared.Sdk.targets file for the GetFileSystemEntries task?

Remove this line:

SessionId="$(BuildSessionId)"

So the task looks like this:

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

The path to the file to edit on Windows is probably (not necessarily):

C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7054\targets\Xamarin.Shared.Sdk.targets

@NebulaSleuth
Copy link

@rolfbjarne I tried the original fix suggested with no luck. I just tried the recent suggestion to remove the SessionId property entirely and still get the same error.

@NebulaSleuth
Copy link

@rolfbjarne I noticed that the link you gave Xamarin.Shared.Sdk.targets file is significantly different than the one I have, which is from 16.4.7060. Is there a workload discrepancy?

Installed Workload Id Manifest Version Installation Source

ios 16.4.7060/7.0.100 SDK 7.0.300, VS 17.6.33717.318
maccatalyst 16.4.7060/7.0.100 SDK 7.0.300, VS 17.6.33717.318
maui-maccatalyst 7.0.86/7.0.100 VS 17.6.33717.318
maui-ios 7.0.86/7.0.100 VS 17.6.33717.318
maui-windows 7.0.86/7.0.100 VS 17.6.33717.318
maui-android 7.0.86/7.0.100 VS 17.6.33717.318
android 33.0.46/7.0.100 VS 17.6.33717.318

@AidarNurmukhametov
Copy link

@rolfbjarne I tried and partially succeeded. Deleting SessionId helped with GetFileSystemEntries, but now it crashes on FilterStaticFrameworks https://github.com/rolfbjarne/xamarin-macios/blob/7e3297578111dedbf4f7041f8a40bc4285b49fd8/dotnet/targets/Xamarin.Shared.Sdk.targets#LL671C3-L671C3

The error is MT7091 File 'C:/Users/aidar/.nuget/packages/devexpress.maui.collectionview/22.2.6/lib/net7.0-ios15.4/DevExpress.iOS.CollectionView.resources/DXListView.xcframework/ios-arm64/DXListView.framework/DXListView' is not a valid framework: Unable to read beyond the end of the stream. On paired mac this file has zero length.

build1.binlog.txt

@rolfbjarne
Copy link
Member

@AidarNurmukhametov

On paired mac this file has zero length.

And the file is not empty on Windows?

C:/Users/aidar/.nuget/packages/devexpress.maui.collectionview/22.2.6/lib/net7.0-ios15.4/DevExpress.iOS.CollectionView.resources/DXListView.xcframework/ios-arm64/DXListView.framework/DXListView

The binlog shows that this file was copied from Windows:

[xma][info]: SCP uploading 'C:/Users/aidar/.nuget/packages/devexpress.maui.collectionview/22.2.6/lib/net7.0-ios15.4/DevExpress.iOS.CollectionView.resources/DXListView.xcframework/ios-arm64/DXListView.framework/DXListView' to 'C:/Users/aidar/.nuget/packages/devexpress.maui.collectionview/22.2.6/lib/net7.0-ios15.4/DevExpress.iOS.CollectionView.resources/DXListView.xcframework/ios-arm64/DXListView.framework/DXListView' for 'MauiApp1'...

@rolfbjarne
Copy link
Member

@NebulaSleuth

I just tried the recent suggestion to remove the SessionId property entirely and still get the same error.

I found that I had to restart Visual Studio as well for this to work.

rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue May 24, 2023
The GetFileSystemEntries task does not need to be remoted, because it's only
used to figure out which additional files to copy from binding projects to
projects that reference the binding projects, and that can happen entirely on
the local build (wherever that is).

Ref:

* https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1808448 (third attempt)
* xamarin#18308
rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue May 24, 2023
… to the Mac.

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)
* xamarin#18308
@AidarNurmukhametov
Copy link

AidarNurmukhametov commented May 24, 2023

@rolfbjarne

And the file is not empty on Windows?

It's not empty. Don't know how it works, maybe another task rewrites it at some point later. Can't check how many times this file on mac is changed during build process.

@NebulaSleuth
Copy link

NebulaSleuth commented May 24, 2023

@rolfbjarne So making the change to remove SessionId like this:

image

then deleting bin/obj restarting VS produces the following error, which sounds like a malformed xml, but I am sure its not:

2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7060\tools\msbuild\iOS\Xamarin.Shared.targets(137,3): error MSB4018: The "ResolveNativeReferences" task failed unexpectedly. 2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7060\tools\msbuild\iOS\Xamarin.Shared.targets(137,3): error MSB4018: System.Xml.XmlException: Root element is missing. 2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7060\tools\msbuild\iOS\Xamarin.Shared.targets(137,3): error MSB4018: at System.Xml.XmlTextReaderImpl.Throw(Exception e) 2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7060\tools\msbuild\iOS\Xamarin.Shared.targets(137,3): error MSB4018: at System.Xml.XmlTextReaderImpl.ParseDocumentContent() 2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7060\tools\msbuild\iOS\Xamarin.Shared.targets(137,3): error MSB4018: at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) 2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7060\tools\msbuild\iOS\Xamarin.Shared.targets(137,3): error MSB4018: at System.Xml.XmlDocument.Load(XmlReader reader) 2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7060\tools\msbuild\iOS\Xamarin.Shared.targets(137,3): error MSB4018: at Xamarin.PListExtensions.LoadWithoutNetworkAccess(XmlDocument doc, String filename) in /Users/builder/azdo/_work/1/s/xamarin-macios/tools/common/PListExtensions.cs:line 15 2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7060\tools\msbuild\iOS\Xamarin.Shared.targets(137,3): error MSB4018: at Xamarin.MacDev.Tasks.ResolveNativeReferencesBase.ProcessSidecar(ITaskItem r, String resources, List1 native_frameworks) in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/ResolveNativeReferencesBase.cs:line 149
2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7060\tools\msbuild\iOS\Xamarin.Shared.targets(137,3): error MSB4018: at Xamarin.MacDev.Tasks.ResolveNativeReferencesBase.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/ResolveNativeReferencesBase.cs:line 100
2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7060\tools\msbuild\iOS\Xamarin.Shared.targets(137,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
2>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7060\tools\msbuild\iOS\Xamarin.Shared.targets(137,3): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()`

@rolfbjarne
Copy link
Member

@NebulaSleuth the ResolveNativeReferences task will try to read an xml file, so I believe that's where the malformed xml comes from (if the Xamarin.Shared.Sdk.targets file ends up as malformed xml you'd get a very different error).

Could you get a binlog for this error?

@omghb
Copy link

omghb commented May 25, 2023

I got a very similar error - but it might not be 100% the same.

It occurs quite often since I updated VS from 17.5.5 to 17.6.1. Sometimes, I'm able to get it running again by re-starting Visual Studio.

3>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 Build190102 while executing a reply for topic xvs/build/1.9.0.102/execute-task/{AppName}/b2e555d002fGetFileSystemEntries
3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7054\targets\Xamarin.Shared.Sdk.targets(2014,3): error : ArgumentNullException: Value cannot be null.
3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7054\targets\Xamarin.Shared.Sdk.targets(2014,3): error : Parameter name: path2
3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7054\targets\Xamarin.Shared.Sdk.targets(2014,3): error :

@rolfbjarne
Copy link
Member

@omghb

I got a very similar error - but it might not be 100% the same.

It occurs quite often since I updated VS from 17.5.5 to 17.6.1. Sometimes, I'm able to get it running again by re-starting Visual Studio.

3>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 Build190102 while executing a reply for topic xvs/build/1.9.0.102/execute-task/{AppName}/b2e555d002fGetFileSystemEntries
3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7054\targets\Xamarin.Shared.Sdk.targets(2014,3): error : ArgumentNullException: Value cannot be null.
3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7054\targets\Xamarin.Shared.Sdk.targets(2014,3): error : Parameter name: path2
3>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7054\targets\Xamarin.Shared.Sdk.targets(2014,3): error :

Looks like the same issue (the important part is "GetFileSystemEntries" in the error message).

Can you try the workaround here to see if it helps?

#18308 (comment)

rolfbjarne added a commit 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
vs-mobiletools-engineering-service2 pushed a commit to vs-mobiletools-engineering-service2/xamarin-macios that referenced this issue May 25, 2023
… to the Mac.

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)
* xamarin#18308
@rolfbjarne
Copy link
Member

I've merged another attempt at a fix for the problem with the GetFileSystemEntries task reported in this issue, and we'll ship it in a service release as soon as possible.

Workaround

The workaround is to remove the SessionId property in your local Xamarin.Shared.Sdk.targets file for the GetFileSystemEntries task.

That means removing this line :

SessionId="$(BuildSessionId)"

From the GetFileSystemEntries task in this file:

C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7054\targets\Xamarin.Shared.Sdk.targets

So the task looks like this:

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

This would be the approximate location in the file:

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

The workaround doesn't work

Please get a binlog and we'll have a look.

@AidarNurmukhametov I tried creating a project referencing the DevExpress NuGets to try to reproduce the second problem you were seeing, and it worked just fine for me, so I'll either need a binlog or a test project to reproduce the problem in order to diagnose it.

@NebulaSleuth the stack trace you posted doesn't give me enough information to even start trying to reproduce the issue, so I'll also need either a binlog or a test project in order to diagnose further.

@jadenrogers
Copy link

jadenrogers commented May 25, 2023

I can confirm this solved it for me.

I did also have to clear my .nuget packages folder under C:\Users\{YourUser}\.nuget\packages as during whatever the issue was it would zero out (0kb) some of the nuget files leaving it in a bad state.

Much appreciated

dalexsoto pushed a commit that referenced this issue May 25, 2023
…ask capable of copying files to the Mac. (#18342)

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


Backport of #18324

---------

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
@rolfbjarne
Copy link
Member

I did also have to clear my .nuget packages folder under C:\Users\{YourUser}\.nuget\packages as during whatever the issue was it would zero out (0kb) some of the nuget files leaving it in a bad state.

I filed this here: #18348

@scriptBoris
Copy link

scriptBoris commented May 28, 2023

@rolfbjarne not worked for me. My VS2022 17.6.2

binlog: TipTronicMaui_Debug_AnyCPU_Build_2023-05-28T12_49_52.0026443+06_00.zip

@theadin
Copy link

theadin commented May 29, 2023

@rolfbjarne Your workaround worked for me. Thanks.

After the next release of VS, should the line
SessionId="$(BuildSessionId)"
be re-added to the "Xamarin.Shared.Sdk.targets" file?

@NebulaSleuth
Copy link

NebulaSleuth commented May 29, 2023

Success! Not sure which step resolved it. But I can confirm that the removal of the SessionId did indeed work after doing the following. I suspect that the key was what @jadenrogers suggested which was to clear the nuget cache at: C:\Users{YourUser}.nuget\packages

For reference... Here are all the steps I took:

Deleted Paired Mac from VS 2022
Updated Mac to 13.4 Ventura
Updated VS Mac to 17.5.6 (build 3)
Updated VS 2022 on PC to 17.6.2
edited 16.04.7054\targets\Xamarin.Shared.Sdk.Targets to remove SessionId="$(BuildSessionId)" line
edited 16.04.7060\targets\Xamarin.Shared.Sdk.Targets to remove SessionId="$(BuildSessionId)" line
deleted C:\Users{YourUser}.nuget\packages folder
deleted project bin and obj folders.
Rebooted Mac
Rebooted PC
Paired Mac to PC
Rebuild solution and start debug to target device (physical iPhone)

@rolfbjarne
Copy link
Member

@scriptBoris

@rolfbjarne not worked for me. My VS2022 17.6.2

binlog: TipTronicMaui_Debug_AnyCPU_Build_2023-05-28T12_49_52.0026443+06_00.zip

That looks like a different problem, so please file a new issue and we'll start diagnosing it.

@sang-hyeon
Copy link

following action worked for me.

  1. remove SsesionId
  2. Dotnet restore {project file name}

@syewchuk
Copy link

syewchuk commented Jun 2, 2023

I removed the SessionId but now I am getting a new error, similar to @AidarNurmukhametov above

Error MT0140 File '/Users/cba/Library/Caches/Xamarin/mtbs/builds/Project/39990b00d3e8c37b4648e8c8c87e039cc7596b9d4b6ba1a104e4c8486b40fa9b/obj/Debug/net7.0-ios/ios-arm64/linker-cache/GoogleMapsUtils.framework/GoogleMapsUtils' is not a valid framework.

CentralNode_devenv_PID=16716_x64_BuildManager_Default.zip

@InquisitorJax
Copy link

@syewchuk did you clear the nuget cache? What's been happening is the build operation before was making the native framework files 0KB. Clearing the nuget cache should fix that up.

@syewchuk
Copy link

syewchuk commented Jun 2, 2023

@InquisitorJax I tried clearing the nuget cache right now, but it doesn't seem to make a difference. The problem appears to be slightly different because on my mac the linker-cache folder is actually empty, and the GoogleMapsUtils.framework folder does not exist.

@syewchuk
Copy link

syewchuk commented Jun 3, 2023

My issue only appeared after I applied the workaround, but my best guess so far is that maybe it is unrelated and has to do with the framework bindings. I'm new to that so don't know if I'm doing it right.

My errors are also similar to this issue:
dotnet/maui#8000

2>C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk\16.4.7054\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(332,3): warning MT0079: The recommended Xcode version for Microsoft.iOS 16.4.7054 is Xcode 14.3 or later. The current Xcode version (found in /Applications/Xcode.app/Contents/Developer) is 14.2.
2>
2>C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk\16.4.7054\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(332,3): warning MT1302: Could not extract the native library 'GoogleMapsUtils.framework' from 'C:/Users/syewchuk/source/repos/iOSBindingsTest/GoogleMapsUtils.Bindings/bin/Debug/net7.0-ios/GoogleMapsUtils.Bindings.dll'. Please ensure the native library was properly embedded in the managed assembly (if the assembly was built using a binding project, the native library must be included in the project, and its Build Action must be 'ObjcBindingNativeLibrary').
2>
2>C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk\16.4.7054\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(332,3): error MT0140: File '/Users/cba/Library/Caches/Xamarin/mtbs/builds/iOSBindingsTest/abdb101264ed277c1cd210d89aa5ad2301fb4b242da08f93aa98c8981a4c0d42/obj/Debug/net7.0-ios/iossimulator-x64/linker-cache/GoogleMapsUtils.framework/GoogleMapsUtils' is not a valid framework.
2>
2>C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk\16.4.7054\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(332,3): error MT2342: The linker step 'Extract Binding Libraries' failed during processing: File '/Users/cba/Library/Caches/Xamarin/mtbs/builds/iOSBindingsTest/abdb101264ed277c1cd210d89aa5ad2301fb4b242da08f93aa98c8981a4c0d42/obj/Debug/net7.0-ios/iossimulator-x64/linker-cache/GoogleMapsUtils.framework/GoogleMapsUtils' is not a valid framework.
2>

I don't know if this is relevant, but my macbook is on XCode 14.2 with macOS Monterey.

EDIT: I've created a new issue:
#18402

@scriptBoris
Copy link

Where can I see the progress on solving this error? I have deadlines on my project.

@rolfbjarne
Copy link
Member

@scriptBoris did you file a new issue as I requested here?

@scriptBoris
Copy link

@scriptBoris did you file a new issue as I requested here?

I done
#18432

@UkeHa
Copy link

UkeHa commented Jun 15, 2023

@rolfbjarne i ran into the same/a similar issue with devexpress packages in my maui-project. With your mentioned workarounds i can successfuly build on a remote ios device via a simulator. But it doesn't work on a local iOS device.

Here's my binlog:
Maui_Debug_AnyCPU_net7.0-ios_Local_ios_device.binlog.zip

EDIT: Removing (DestinationSubDirectory) from Xamarin.iOS.HotRestart.targets is a workaround for me.


		<!-- Copy assemblies and debug symbols into app bundle's content folder -->
		<Copy SourceFiles="@(_FilesToHotRestartContent)"
      DestinationFiles="@(_FilesToHotRestartContent -> '$(HotRestartAppContentDir)%(DestinationSubDirectory)%(FileName)%(Extension)')"
      SkipUnchangedFiles="true"
      Condition="'@(_FilesToHotRestartContent)' != ''">

@rolfbjarne
Copy link
Member

@UkeHa when you say it doesn't work on a local iOS device: how does it fail? There are no errors in the build log you attached.

@UkeHa
Copy link

UkeHa commented Jun 15, 2023

It fails to start and says that it intends to remove a file but the directory doesn't exist. It seems like the path is too long (260+). Even allowing longer paths in Windows doesn't fix the issue. My workaround is removing the subdirectory. That leads to a smaller path and it works as expected.

@ghost ghost locked as resolved and limited conversation to collaborators Jul 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug If an issue is a bug or a pull request a bug fix regression The issue or pull request is a regression
Projects
None yet
Development

No branches or pull requests