microsoft / appcenter-sdk-dotnet

Development repository for the App Center SDK for .NET platforms, including Xamarin
Other
309 stars 141 forks source link

Microsoft.AppCenter.Crashes clang++ exited with code 1 when compiling for ios-simulator on pair arm64 mac in VS for Windows #1755

Closed jsiemensLatitudegeo closed 7 months ago

jsiemensLatitudegeo commented 1 year ago

Description

If you try to use the Microsoft.AppCenter.Crashes in a .net maui app in Visual Studio for Windows paired with an arm64 Mac, deploying to the ios simulator, then you get an error:

Severity Code Description Project File Line Suppression State Error clang++ exited with code 1: ld: in /Users/[user]/Library/Caches/Xamarin/mtbs/builds/MauiApp1/baf8b3e6a4f75682439ae911f842ade66bd1741bc02fc255b853516d938283c3/obj/Debug/net7.0-ios/iossimulator-x64/linker-cache/AppCenter.a(MSACAppCenter.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/[user]/Library/Caches/Xamarin/mtbs/builds/MauiApp1/baf8b3e6a4f75682439ae911f842ade66bd1741bc02fc255b853516d938283c3/obj/Debug/net7.0-ios/iossimulator-x64/linker-cache/AppCenter.a' for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) MauiApp1 C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.4.7098\targets\Xamarin.Shared.Sdk.targets 1274

Repro Steps

  1. Create new maui app in VS for Windows
  2. Pair to Mac (arm64 - eg. m1 or m2)
  3. Build and deploy to ios simulator

Details

  1. What is your app platform (Xamarin.Android or Xamarin.iOS or UWP)?
    • e.g. MAUI on all 3 platforms (Android, iOS and UWP).
  2. If using Xamarin.Forms or if using portable/shared code to call our SDK APIs, are you using shared project, PCL code or .NET standard code for the application? Which .NET standard version or which PCL profile?
    • e.g. Multitargeting
  3. Which SDK version are you using?
    • e.g. 5.0.2
  4. Which OS version did you experience the issue on?
    • e.g. iOS 16.4 Simulator
  5. What device version did you see this error on? Were you using an emulator or a physical device?
    • e.g. iPhone 14 Simulator running iOS 16.4
  6. What third party libraries are you using?
    • Just yours
  7. Please enable verbose logging for your app using AppCenter.LogLevel = LogLevel.Verbose before your call to AppCenter.Start(...) and include the logs here:
IBFAO commented 1 year ago

I have the same error for MAUI app with the iOS simulator on Mac since I upgraded to .net 8

FM1973 commented 1 year ago

I got the same problem. I my case I´ve installed .net RC1 as well. But I got the problem when using AppCenter in .net 7 with MAUI 7.0.59.

rogerbriggen-securiton commented 1 year ago

Same here. After installing dotnet 8 RC1 on the mac I have the same problem when compiling for dotnet 8. Note: I am building on the mac from the console so it is not about windows and pair but it is just the compilation on the mac.

tipa commented 1 year ago

Hope this will be fixed soon. Very easy to reproduce

dotnet new ios
dotnet add package Microsoft.AppCenter.Analytics
dotnet build
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.8825-net8-rc1/targets/Xamarin.Shared.Sdk.targets(1589,3): error : clang++ exited with code 1: [/Users/tipa/GitHub/Neuer Ordner/Neuer Ordner.csproj]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.8825-net8-rc1/targets/Xamarin.Shared.Sdk.targets(1589,3): error : ld: warning: ignoring duplicate libraries: '-lSystem.Globalization.Native', '-lSystem.IO.Compression.Native', '-lSystem.Native', '-lSystem.Net.Security.Native', '-lSystem.Security.Cryptography.Native.Apple', '-lcompression', '-lmono-component-debugger', '-lmono-component-diagnostics_tracing', '-lmono-component-hot_reload', '-lmono-component-marshal-ilgen', '-lmonosgen-2.0', '-lxamarin-dotnet-debug' [/Users/tipa/GitHub/Neuer Ordner/Neuer Ordner.csproj]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.8825-net8-rc1/targets/Xamarin.Shared.Sdk.targets(1589,3): error : ld: building for 'iOS-simulator', but linking in object file (/Users/tipa/GitHub/Neuer Ordner/obj/Debug/net8.0-ios/iossimulator-arm64/linker-cache/AppCenter.a[arm64][2](MSACAppCenter.o)) built for 'iOS' [/Users/tipa/GitHub/Neuer Ordner/Neuer Ordner.csproj]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.8825-net8-rc1/targets/Xamarin.Shared.Sdk.targets(1589,3): error : clang: error: linker command failed with exit code 1 (use -v to see invocation) [/Users/tipa/GitHub/Neuer Ordner/Neuer Ordner.csproj]
gerneio commented 1 year ago

Same issue when upgrading MAUI workloads from 7.0.86 to 7.0.92 as well as from .NET SDK 7.0.302 to 7.0.401, on both Windows and paired Mac. Pretty sure my Xcode on the ARM64 Mac was already on 14.3 and this was working just fine before the .NET upgrades. I also updated the AppCenter nuget from 5.0.2 to 5.0.3, but same results.

Ultimately the suggestion by the MAUI team on another thread allowed me to build and deploy to an iOS simulator, but not sure if there are any side-effects yet. Have not yet tried on a physical device, or release deployment for that matter.

Quick fix:

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'">
    <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
</PropertyGroup>

For the MS-AppCenter team, the MAUI team suggested the following for the reason for the issue:

@rolfbjarne: Looks like AppCenter doesn't ship support for the iossimulator-arm64 architecture, so this is an AppCenter issue.

vecalion commented 1 year ago

Experiencing the same issue.

DmitriyKirakosyan commented 1 year ago

@tipa

Hope this will be fixed soon. Very easy to reproduce

dotnet new ios dotnet add package Microsoft.AppCenter.Analytics dotnet build

The build succeeded for me using your steps. Are you building it on intel or m1/m2 mac?

tipa commented 1 year ago

I am building on a M1 Mac. Make sure it creates and builds the project with .NET 8 - it builds as expected with .NET 7. I just tested again with .NET 8 RC 2 and the error still shows

tipa@Mac-mini asdad % dotnet build
MSBuild version 17.8.0+6cdef4241 for .NET
  Determining projects to restore...
  Restored /Users/tipa/GitHub/subtotal/SubTotal.macOS/asdad/asdad.csproj (in 133 ms).
/usr/local/share/dotnet/sdk/8.0.100-rc.2.23502.2/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets(311,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [/Users/tipa/GitHub/subtotal/SubTotal.macOS/asdad/asdad.csproj]
  Detected signing identity:

    Bundle Id: com.companyname.asdad
    App Id: com.companyname.asdad
  asdad -> /Users/tipa/GitHub/subtotal/SubTotal.macOS/asdad/bin/Debug/net8.0-ios/iossimulator-arm64/asdad.dll
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  Optimizing assemblies for size. This process might take a while.
  Tool xcrun execution finished (exit code = 1).

  ld: warning: ignoring duplicate libraries: '-lSystem.Globalization.Native', '-lSystem.IO.Compression.Native', '-lSystem.Native', '-lSystem.Net.Security.Native', '-lSystem.Security.Cryptography.Native.Apple', '-lcompression', '-lmono-component-debugger', '-lmono-component-diagnostics_tracing', '-lmono-component-hot_reload', '-lmono-component-marshal-ilgen', '-lmonosgen-2.0', '-lxamarin-dotnet-debug'
  ld: building for 'iOS-simulator', but linking in object file (/Users/tipa/GitHub/subtotal/SubTotal.macOS/asdad/obj/Debug/net8.0-ios/iossimulator-arm64/linker-cache/AppCenter.a[arm64][2](MSACAppCenter.o)) built for 'iOS'
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.8968-net8-rc2/targets/Xamarin.Shared.Sdk.targets(1556,3): error : clang++ exited with code 1: [/Users/tipa/GitHub/subtotal/SubTotal.macOS/asdad/asdad.csproj]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.8968-net8-rc2/targets/Xamarin.Shared.Sdk.targets(1556,3): error : ld: warning: ignoring duplicate libraries: '-lSystem.Globalization.Native', '-lSystem.IO.Compression.Native', '-lSystem.Native', '-lSystem.Net.Security.Native', '-lSystem.Security.Cryptography.Native.Apple', '-lcompression', '-lmono-component-debugger', '-lmono-component-diagnostics_tracing', '-lmono-component-hot_reload', '-lmono-component-marshal-ilgen', '-lmonosgen-2.0', '-lxamarin-dotnet-debug' [/Users/tipa/GitHub/subtotal/SubTotal.macOS/asdad/asdad.csproj]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.8968-net8-rc2/targets/Xamarin.Shared.Sdk.targets(1556,3): error : ld: building for 'iOS-simulator', but linking in object file (/Users/tipa/GitHub/subtotal/SubTotal.macOS/asdad/obj/Debug/net8.0-ios/iossimulator-arm64/linker-cache/AppCenter.a[arm64][2](MSACAppCenter.o)) built for 'iOS' [/Users/tipa/GitHub/subtotal/SubTotal.macOS/asdad/asdad.csproj]
/usr/local/share/dotnet/packs/Microsoft.iOS.Sdk/16.4.8968-net8-rc2/targets/Xamarin.Shared.Sdk.targets(1556,3): error : clang: error: linker command failed with exit code 1 (use -v to see invocation) [/Users/tipa/GitHub/subtotal/SubTotal.macOS/asdad/asdad.csproj]

Build FAILED.
DmitriyKirakosyan commented 1 year ago

That's intriguing. For Mac users, the issue appears only on .NET 8. However, when building from Windows in conjunction with Mac, it's reproducible on .NET 7.

If the problem stemmed from a missing architecture in the AppCenter SDK binary, it would be present across all versions of .NET. I suspect this might be a .NET-related issue. Let's keep this open and gather additional details about this problem.

If anyone has a solution or suggestion, contributions are always appreciated!

rolfbjarne commented 1 year ago

If the problem stemmed from a missing architecture in the AppCenter SDK binary, it would be present across all versions of .NET. I suspect this might be a .NET-related issue. Let's keep this open and gather additional details about this problem.

It's an AppCenter SDK issue, the problem is that the AppCenter SDK doesn't support arm64 in the simulator.

The difference is that in later versions .NET/IDE we've changed the default architecture (RuntimeIdentifier) we build for the simulator when building on an arm64 mac: in initial .NET 6 + .NET 7 releases the default was iossimulator-x64, now (in .NET 8 + some versions of .NET 7 depending on the VS version) it's iossimulator-arm64 when building on an arm64 mac.

That's why the workaround works in the IDE:

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'">
    <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
</PropertyGroup>

It forces using iossimulator-x64 when building from the IDE.

Note that device builds are not affected in any way.

markbeaton commented 11 months ago

This has been biting us for a while too as we much prefer to develop using the ARM64 Simulator on our Apple Silicon Macs, but it's currently not possible for dotnet projects - we are either forced to use the x64 sim via Rosetta (using @rolfbjarne's suggested workaround above), or remove references to the AppCenter packages.

I suspect a lot of folks don't realise that ARM64 simulator and ARM64 device binaries are two different, non-compatible things & support for both requires bundling XCFrameworks inside the nupkg payloads, containing both the ios-arm64 and ios-arm64-simulator (or ios-arm64_x86_64-simulator) sub-frameworks.

See here for more information (including lots of good stuff from @rolfbjarne)

Hooterr commented 11 months ago

It's not a deal breaker, but it'd certainly be nice to be able to run arm64 simulator. When run in x64 mode, the simulator is (imo) a bit slower, and there's a scrolling bug. You can't fling a scrollview or collection (it's an iOS bug but MAUI, same happens in Swift app).

Out of all the packages we have only appcenter is not compatible with arm64. What we have is a build profile that removes dependency on AppCenter and in code we check for that build profile so that we don't call any AppCenter APIs.

sledderGIT commented 11 months ago

Experiencing the same issue. Have to exclude Appcenter from my Solution.

plppp2001 commented 10 months ago

Same issue when upgrading MAUI workloads from 7.0.86 to 7.0.92 as well as from .NET SDK 7.0.302 to 7.0.401, on both Windows and paired Mac. Pretty sure my Xcode on the ARM64 Mac was already on 14.3 and this was working just fine before the .NET upgrades. I also updated the AppCenter nuget from 5.0.2 to 5.0.3, but same results.

Ultimately the suggestion by the MAUI team on another thread allowed me to build and deploy to an iOS simulator, but not sure if there are any side-effects yet. Have not yet tried on a physical device, or release deployment for that matter.

Quick fix:

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'">
    <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
</PropertyGroup>

For the MS-AppCenter team, the MAUI team suggested the following for the reason for the issue:

@rolfbjarne: Looks like AppCenter doesn't ship support for the iossimulator-arm64 architecture, so this is an AppCenter issue.

I tried this doesn't work, but I'm using .NET8 I did this:

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'">
    <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
</PropertyGroup>
plppp2001 commented 10 months ago

Experiencing the same issue. Have to exclude Appcenter from my Solution.

.NET 8 MAUI?

daniel-smith-sonepar commented 10 months ago

agreed i have same issue with .net 8 maui and workaround is not working for me either

plppp2001 commented 10 months ago

agreed i have same issue with .net 8 maui and workaround is not working for me either

Can you try this out for me please, add this setting, reload your project, close VS and reopen and build again?

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|**net8.0-ios**|AnyCPU'">
    <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
    <RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
</PropertyGroup>
daniel-smith-sonepar commented 10 months ago

actually i just had same thought - i simply unloaded project, reloaded and did a rebuild and it launched!

So the workaround did work for me once i did reload and rebuild of project.

plppp2001 commented 10 months ago

actually i just had same thought - i simply unloaded project, reloaded and did a rebuild and it launched!

So the workaround did work for me once i did reload and rebuild of project.

Did you add this one: <RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>

daniel-smith-sonepar commented 10 months ago

actually i just had same thought - i simply unloaded project, reloaded and did a rebuild and it launched! So the workaround did work for me once i did reload and rebuild of project.

Did you add this one: <RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>

No I did not add that line and I confirmed I do not have the RuntimeIdentifier set in the project file anywhere

kocevilija commented 10 months ago

agreed i have same issue with .net 8 maui and workaround is not working for me either

Can you try this out for me please, add this setting, reload your project, close VS and reopen and build again?

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|**net8.0-ios**|AnyCPU'">
  <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
  <RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
</PropertyGroup>

This solution has worked for me to fix the issue after updating to .NET8 and MAUI 8.

PS. I am using both Microsoft.AppCenter.Crashes and BarcodeScanner.Mobile.Maui nuget packages that do not have the arm64 slice and they work as well.

sledderGIT commented 10 months ago

agreed i have same issue with .net 8 maui and workaround is not working for me either

Can you try this out for me please, add this setting, reload your project, close VS and reopen and build again?

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|**net8.0-ios**|AnyCPU'">
    <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
    <RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
</PropertyGroup>

This solution has worked for me to fix the issue after updating to .NET8 and MAUI 8.

PS. I am using both Microsoft.AppCenter.Crashes and BarcodeScanner.Mobile.Maui nuget packages that do not have the arm64 slice and they work as well.

I'm working on Mac with M1 so I want to launch my project with ARM64 simulator. So for me this workaround is not suetable.

We have just cut the AppCenter from Debug configs

  <ItemGroup Condition="!$(Configuration.Contains('Debug'))">
    <PackageReference Include="Microsoft.AppCenter" Version="5.0.3" />
    <PackageReference Include="Microsoft.AppCenter.Analytics" Version="5.0.3" />
    <PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.3" />
  </ItemGroup>
DmitriyKirakosyan commented 10 months ago

I'm going to upload the POC nuget packages, which are intended to resolve this issue. If you have some time, could you please test it and let me know if it works for you?

Microsoft.AppCenter.5.0.5-SNAPSHOT.nupkg.zip Microsoft.AppCenter.Analytics.5.0.5-SNAPSHOT.nupkg.zip Microsoft.AppCenter.Crashes.5.0.5-SNAPSHOT.nupkg.zip

sledderGIT commented 10 months ago

I'm going to upload the POC nuget packages, which are intended to resolve this issue. If you have some time, could you please test it and let me know if it works for you?

Microsoft.AppCenter.5.0.5-SNAPSHOT.nupkg.zip Microsoft.AppCenter.Analytics.5.0.5-SNAPSHOT.nupkg.zip Microsoft.AppCenter.Crashes.5.0.5-SNAPSHOT.nupkg.zip

Sure! I'll test it

snckirkmarken commented 10 months ago

Hi @DmitriyKirakosyan, this looks like it's worked for us so far, thank you!

The same issue exists with Microsoft.AppCenter.Distribute. Do you plan to add the same change for that too?

markbeaton commented 10 months ago

@DmitriyKirakosyan Confirming that the 5.0.5-SNAPSHOT packages are working for me on the ARM64 Simulator - thanks.

DmitriyKirakosyan commented 10 months ago

The same issue exists with Microsoft.AppCenter.Distribute. Do you plan to add the same change for that too?

@snckirkmarken , Distribute is a bit trickier. Working on it...

jbe2277 commented 10 months ago

Update: The workaround provided below does not fix the issue completely. The following warning gets fixed but deploying to iOS simulators running on an ARM Mac does still not work:

Found version-specific or distribution-specific runtime identifier(s): alpine-arm, alpine-arm64, alpine-x64. Affected libraries: SQLitePCLRaw.lib.e_sqlite3. In .NET 8.0 and higher, assets for version-specific and distribution-specific runtime identifiers will not be found by default. See https://aka.ms/dotnet/rid-usage for details.

I believe this issue is because of the reference: SQLitePCLRaw.bundle_green (>= 2.1.5) in the AppCenter 5.0.3 package.

The SQLitePCL.raw repo fixed this in 2.1.6:

Workaround:

SprengerS commented 10 months ago

I'm going to upload the POC nuget packages, which are intended to resolve this issue. If you have some time, could you please test it and let me know if it works for you?

Microsoft.AppCenter.5.0.5-SNAPSHOT.nupkg.zip Microsoft.AppCenter.Analytics.5.0.5-SNAPSHOT.nupkg.zip Microsoft.AppCenter.Crashes.5.0.5-SNAPSHOT.nupkg.zip

The packages are working on the new iOS Simulator Devices, but not on real Devices. The following error in the console occurs:

ASI found [dyld] (sensitive) 'Library not loaded: @rpath/Frameworks/AppCenterCrashes.framework/AppCenterCrashes
  Referenced from: <6BD34BA9-9317-35E1-89A2-BB1CAC37D4D1> /private/var/containers/Bundle/Application/691CA60F-FEA0-4A98-9585-A1E62E2A3C62/Hoermann.BleApp.iOS.app/Hoermann.BleApp.iOS
  Reason: tried: '/private/var/containers/Bundle/Application/691CA60F-FEA0-4A98-9585-A1E62E2A3C62/Hoermann.BleApp.iOS.app/Frameworks/Frameworks/AppCenterCrashes.framework/AppCenterCrashes' (no such file), '/private/var/containers/Bundle/Application/691CA60F-FEA0-4A98-9585-A1E62E2A3C62/Hoermann.BleApp.iOS.app/Frameworks/Frameworks/AppCenterCrashes.framework/AppCenterCrashes' (no such file)'
durandt commented 10 months ago

agreed i have same issue with .net 8 maui and workaround is not working for me either

Can you try this out for me please, add this setting, reload your project, close VS and reopen and build again?

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|**net8.0-ios**|AnyCPU'">
  <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
  <RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
</PropertyGroup>

This solution has worked for me to fix the issue after updating to .NET8 and MAUI 8. PS. I am using both Microsoft.AppCenter.Crashes and BarcodeScanner.Mobile.Maui nuget packages that do not have the arm64 slice and they work as well.

I'm working on Mac with M1 so I want to launch my project with ARM64 simulator. So for me this workaround is not suetable.

We have just cut the AppCenter from Debug configs

  <ItemGroup Condition="!$(Configuration.Contains('Debug'))">
    <PackageReference Include="Microsoft.AppCenter" Version="5.0.3" />
    <PackageReference Include="Microsoft.AppCenter.Analytics" Version="5.0.3" />
    <PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.3" />
  </ItemGroup>

Same here, work-arounds would not make the error disappear (M1 Pro mac, tried using Rider, VSCode and command line build)

InquisitorJax commented 10 months ago

any eta on when the 5.0.5 fix will be released?

snckirkmarken commented 10 months ago

The same issue exists with Microsoft.AppCenter.Distribute. Do you plan to add the same change for that too?

@snckirkmarken , Distribute is a bit trickier. Working on it...

Happy New Year @DmitriyKirakosyan. Please may I ask: how are the Microsoft.AppCenter.Distribute changes coming along?

magtimmermans commented 9 months ago

I am waiting for the release. Do you know when the 5.0.5 fix will be released?

plppp2001 commented 9 months ago

Just use the work around for now?

www.PaulAstramowicz.com


From: magtimmermans @.> Sent: Tuesday, January 16, 2024 11:03:09 AM To: microsoft/appcenter-sdk-dotnet @.> Cc: Paul Astro @.>; Comment @.> Subject: Re: [microsoft/appcenter-sdk-dotnet] Microsoft.AppCenter.Crashes clang++ exited with code 1 when compiling for ios-simulator on pair arm64 mac in VS for Windows (Issue #1755)

I am waiting for the release. Do you know when the 5.0.5 fix will be released?

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/appcenter-sdk-dotnet/issues/1755#issuecomment-1893422007, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AK2EVSVZANKZTL5QE5DOSJTYOZF53AVCNFSM6AAAAAA5IPJDHOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJTGQZDEMBQG4. You are receiving this because you commented.Message ID: @.***>

snckirkmarken commented 9 months ago

@plppp2001 that workaround doesn't work for us

plppp2001 commented 9 months ago

Report that then bill gates

www.PaulAstramowicz.com


From: snckirkmarken @.> Sent: Tuesday, January 16, 2024 11:18:35 AM To: microsoft/appcenter-sdk-dotnet @.> Cc: Paul Astro @.>; Mention @.> Subject: Re: [microsoft/appcenter-sdk-dotnet] Microsoft.AppCenter.Crashes clang++ exited with code 1 when compiling for ios-simulator on pair arm64 mac in VS for Windows (Issue #1755)

@plppp2001https://github.com/plppp2001 that workaround doesn't work for us

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/appcenter-sdk-dotnet/issues/1755#issuecomment-1893448106, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AK2EVSUXKRCKD35RLOLAFR3YOZHXXAVCNFSM6AAAAAA5IPJDHOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJTGQ2DQMJQGY. You are receiving this because you were mentioned.Message ID: @.***>

Mercally commented 9 months ago

I'm going to upload the POC nuget packages, which are intended to resolve this issue. If you have some time, could you please test it and let me know if it works for you?

Microsoft.AppCenter.5.0.5-SNAPSHOT.nupkg.zip Microsoft.AppCenter.Analytics.5.0.5-SNAPSHOT.nupkg.zip Microsoft.AppCenter.Crashes.5.0.5-SNAPSHOT.nupkg.zip

Thank you @DmitriyKirakosyan

I tested with prerelease version provided, it seems it doesn't get fatal errors, but still doesn't work as expected on iOS.

Test environment: MacBook Pro M1. iPhone 15 iOS 17.2 Simulator. (debug mode) Dev environment: Visual Code/Visual Studio for Mac. .Net 8.0 MAUI 8

Issue: No analytics/events collected on App Center portal. Just registering the AppCenter.Start(...) at App.xaml.cs class. And added Analytics.TrackEvent(...) at HomePage OnAppearing.

The debug console: Screenshot 2024-01-16 at 10 18 02 AM

Note: It seems there are no issues on Android.

magtimmermans commented 9 months ago

I have tested on a Windows 10 Machine, Visual Studio 2022 Community. .Net 8.0 MAUI 8.

Here it is also not crashing but also no Analytics in AppCenter. Basicly the same as @Mercally

cleardemon commented 9 months ago

Just to add my experiences here, 5.0.3 (current release version on NuGet) works just fine in deployments, on device. I am not using Windows, but macOS as my development machine (Rider and VSCode).

I have tried using the 5.0.5 snapshots, but, while they allow for the iOS Simulator builds to compile, attempting to use them on an actual device (and test deployment) doesn't work too well, and also fails at the signing process in release builds.

My workaround for now is to continue to use 5.0.3 release versions in deployments, but completely remove App Center from builds on local developer machines. I achieved this by setting a global build constant (by adding a DefineConstants property to Directory.Build.props), some changes to my .csproj files to exclude referencing any App Center packages, and #ifdef blocks in the code to exclude any calls into AppCenter in the compile.

nathenxbrewer commented 9 months ago

This is stopping me from debugging on physical Android devices. I'm using Rider. I'm not entirely sure why Rider is failing to deploy to an Android device for an ios-simulator issue..I've tried all the above workarounds and nothing changes. Using an M3 MacBook Pro.

durandt commented 9 months ago

@nathenxbrewer yeee it's a pretty big bummer. Doesn't help though that Rider seems to have its own set of (unfixed) issues with that (I'm second-guessing, not properly applying the csproj properties suggested in the fixes here). See https://youtrack.jetbrains.com/issue/RIDER-102647/.NET-8-MAUI-Build-fails-on-rider-but-works-fine-on-VS-for-Mac

I was able to make it work with the fixes suggested above when building from command-line and from VSCode but I still get the error on Rider. Sad because the debugging experience in VSCode is horrendous right now (compared to what was possible with VS/VS for mac/Rider).

Don't have access to code right now but I think this fix did it:

  <ItemGroup Condition="!$(Configuration.Contains('Debug'))">
    <PackageReference Include="Microsoft.AppCenter" Version="5.0.3" />
    <PackageReference Include="Microsoft.AppCenter.Analytics" Version="5.0.3" />
    <PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.3" />
  </ItemGroup>
nathenxbrewer commented 9 months ago

@nathenxbrewer yeee it's a pretty big bummer. Doesn't help though that Rider seems to have its own set of (unfixed) issues with that (I'm second-guessing, not properly applying the csproj properties suggested in the fixes here). See https://youtrack.jetbrains.com/issue/RIDER-102647/.NET-8-MAUI-Build-fails-on-rider-but-works-fine-on-VS-for-Mac

I was able to make it work (see my message from 3 weeks ago) when building from command-line and from VSCode but I still get the error on Rider. Sad because the debugging experience in VSCode is horrendous right now (compared to what was possible with VS/VS for mac/Rider)

If I disable Linking, I can deploy to physical Android, but I need to be able to use Hot Reload to work on the UI in my app. The MAUI kit for VSCode is decent, but it also doesn't support Hot Reload. I'll take your suggestion and use that ItemGroup as well as add some compiler directive statements to exclude the using statements. I just got the M3 2 days ago, this was all working great on my Intel Mac I had before that.

nathenxbrewer commented 9 months ago

@nathenxbrewer yeee it's a pretty big bummer. Doesn't help though that Rider seems to have its own set of (unfixed) issues with that (I'm second-guessing, not properly applying the csproj properties suggested in the fixes here). See https://youtrack.jetbrains.com/issue/RIDER-102647/.NET-8-MAUI-Build-fails-on-rider-but-works-fine-on-VS-for-Mac

I was able to make it work with the fixes suggested above when building from command-line and from VSCode but I still get the error on Rider. Sad because the debugging experience in VSCode is horrendous right now (compared to what was possible with VS/VS for mac/Rider).

Don't have access to code right now but I think this fix did it:

  <ItemGroup Condition="!$(Configuration.Contains('Debug'))">
    <PackageReference Include="Microsoft.AppCenter" Version="5.0.3" />
    <PackageReference Include="Microsoft.AppCenter.Analytics" Version="5.0.3" />
    <PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.3" />
  </ItemGroup>

Now it builds on Rider, but my app insta-crashes on both iOS and Android now. I think I'm just gonna run Visual Studio through Parallels and see if that does any better.

alikoli commented 9 months ago

I have 2 probles with these packages: Microsoft.AppCenter.5.0.5-SNAPSHOT.nupkg.zip Microsoft.AppCenter.Analytics.5.0.5-SNAPSHOT.nupkg.zip Microsoft.AppCenter.Crashes.5.0.5-SNAPSHOT.nupkg.zip

  1. It is not possible to send app to app store. When trying to publish to AppStore I get an error: Invalid Bundle. The bundle at 'myapp.app/Frameworks/AppCenterCrashes.framework' contains disallowed file 'Frameworks'

  2. I was testing this package with development on Windows with local device (ipad os). After moving to this package from previous 5.0.3 version I was able to use AppCenter.Start method, which previously caused an error. Calling method Crashes.TrackError with these packages does produce app crash.

dmn-star commented 9 months ago

@DmitriyKirakosyan My app can be built with 5.0.5-SNAPSHOT packages, runs in the iOS simulator but crashes immediately on the iPhone.

ryanalford-suzy commented 9 months ago

Any update on when this will actually get fixed? For me, the workaround when running on a Mac, worked in .Net 7. Now that we have updated to .Net 8, the workaround no longer works. I am back to getting the same build error.

This has been an issue for more than 4 months.

DmitriyKirakosyan commented 8 months ago

Hello everyone, and thank you for your patience.

I'd like to outline the necessary steps to address this issue. Our approach involves using xcframeworks in our binding projects. Specifically, this requires building the AppCenter Apple SDK as a dynamic framework, a challenging task given the complexity of the project's structure. At present, we distribute static xcframeworks, and while .NET 8 might support them (this requires verification), they are not compatible with .NET 7.

Regrettably, I cannot provide a specific ETA for this resolution, as it has been deferred in favor of other priorities. As a temporary solution, I recommend debugging on a physical device or excluding AppCenter during build for emulator debugging.

If you're open to experimenting with a solution for this issue, your efforts would be greatly appreciated. We value and welcome all assistance and contributions.

markbeaton commented 8 months ago

As a temporary solution, I recommend debugging on a physical device or excluding AppCenter during build for emulator debugging.

Here's what we're doing at the moment to achieve this (app .csproj file):

<ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0"/>
    <!-- other packages etc...-->
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
    <PackageReference Include="Microsoft.AppCenter.Analytics" Version="5.0.3"/>
    <PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.3"/>
</ItemGroup>

Something along these lines at app startup:

private void InitialiseAppCenter()
{
    #if !DEBUG
    var appCenterServices = new List<Type>();
    if (BuildConfig.AppCenterCrashesEnabled)
    {
        appCenterServices.Add(typeof(Microsoft.AppCenter.Crashes.Crashes));
    }
    if (BuildConfig.AppCenterAnalyticsEnabled)
    {
        appCenterServices.Add(typeof(Microsoft.AppCenter.Analytics.Analytics));
    }
    if (appCenterServices.Count > 0)
    {
        Microsoft.AppCenter.AppCenter.Start(BuildConfig.AppCenterSecret, appCenterServices.ToArray());
    }
    #endif
}
AlexeyStarkov commented 8 months ago

If the problem stemmed from a missing architecture in the AppCenter SDK binary, it would be present across all versions of .NET. I suspect this might be a .NET-related issue. Let's keep this open and gather additional details about this problem.

It's an AppCenter SDK issue, the problem is that the AppCenter SDK doesn't support arm64 in the simulator.

The difference is that in later versions .NET/IDE we've changed the default architecture (RuntimeIdentifier) we build for the simulator when building on an arm64 mac: in initial .NET 6 + .NET 7 releases the default was iossimulator-x64, now (in .NET 8 + some versions of .NET 7 depending on the VS version) it's iossimulator-arm64 when building on an arm64 mac.

That's why the workaround works in the IDE:

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'">
    <ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
</PropertyGroup>

It forces using iossimulator-x64 when building from the IDE.

Note that device builds are not affected in any way.

Thank you! This workaround works for me when debugging on iOS using .net8 MAUI and Rider IDE.

However, the issue is still there when I target the Android. I mean, c'mon, why does iOS-related crap impact Android builds at all?!!! I've been trying to perform a simple update from .net7 to .net8 for the last two days. And I haven't even seen yet if the application actually looks/behaves as it's expected because it doesn't build.

Does anyone know how to ignore/suppress this issue while building and deploying to Android?

PS: This is just insane - I'm asking for a workaround for a workaround.

durandt commented 8 months ago

@AlexeyStarkov This is also blocking me from updating my MAUI app to .NET 8 and I have sticked to .NET 7. But as I submitted an update to my app yesterday, I was reminded by Apple that I cannot do that for too long:

We noticed one or more issues with a recent delivery for the following app:

<Redacted app information>

Although delivery was successful, you may want to correct the following issues in your next delivery. Once you've corrected the issues, upload a new binary to App Store Connect.

ITMS-90725: SDK version issue - This app was built with the iOS 16.4 SDK. Starting April 29, 2024, all iOS and iPadOS apps must be built with the iOS 17 SDK or later, included in Xcode 15 or later, in order to be uploaded to App Store Connect or submitted for distribution.

I am looking for alternatives to App Center for crash reporting and logging a few events (anyone reading this may give suggestions).

@AlexeyStarkov be aware that Rider has its own set of issues regarding MAUI and .NET 8 om ARM macs... See https://youtrack.jetbrains.com/issue/RIDER-76794/Cannot-deploy-MAUI-project-to-physical-iOS-device-because-of-RuntimeIdentifier (not sure if the right issue, jetbrains issue tracker does not load right now, will update later) So I would advise you to try using VSCode with the C# DevKit and MAUI extensions (although it's not really easy to set up and comes with its own load of issues...). I was able to build with VSCode where Rider would still throw errors.