xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.49k stars 515 forks source link

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

Closed AndreyMarten closed 1 year ago

AndreyMarten commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

We've fixed this already (https://github.com/xamarin/xamarin-macios/pull/18287), and the fix will be in the next service releases.

jadenrogers commented 1 year ago

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

rolfbjarne commented 1 year ago

@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 commented 1 year ago

https://github.com/xamarin/xamarin-macios/pull/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 commented 1 year ago

@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 commented 1 year ago

Hi there,

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

AidarNurmukhametov commented 1 year ago

@rolfbjarne Hope this helps build.binlog.txt

rolfbjarne commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

@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.

AidarNurmukhametov commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

@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?

https://github.com/xamarin/xamarin-macios/issues/18308#issuecomment-1559808140

rolfbjarne commented 1 year ago

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: https://github.com/xamarin/xamarin-macios/blob/6d9ed7910a8d9f5af2e69ac83ff61c0af518a3d5/dotnet/targets/Xamarin.Shared.Sdk.targets#L2019-L2027

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 commented 1 year ago

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

rolfbjarne commented 1 year ago

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: https://github.com/xamarin/xamarin-macios/issues/18348

scriptBoris commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

following action worked for me.

  1. remove SsesionId
  2. Dotnet restore {project file name}
syewchuk commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

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: https://github.com/dotnet/maui/issues/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: https://github.com/xamarin/xamarin-macios/issues/18402

scriptBoris commented 1 year ago

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

rolfbjarne commented 1 year ago

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

scriptBoris commented 1 year ago

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

I done https://github.com/xamarin/xamarin-macios/issues/18432

UkeHa commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

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.