-
Notifications
You must be signed in to change notification settings - Fork 518
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
PlatformNotSupportedException in iOS Release build only #9682
Comments
I can reproduce, the Release configuration works if the linker is turned off (set "Linker behavior" to "Don't Link" in the iOS project's iOS Build options page). The problem is that EntityFramework isn't linker-safe, this is what happens with the linker enabled:
This is already reported and known: dotnet/efcore#10963, so I'm going to close this. |
@rolfbjarne is it possible that we are looking at two separate issues? The NotSupportedPlatform exception is quite specifically called out as being an issue with Xamarin.iOS using a version of microsoft.extensions.dependencyinjection that sets the IL_EMIT variable and it not being supported in ios. Read here. |
@rlasker-b2w can you still reproduce the PlatformNotSupportedException if you disable the linker in your Release build? |
@rolfbjarne so far it does not appear to be logging the platform not supported exception after disabling the linker and functionality seems to be working as expected. Thanks for your help in this manner. I'm curious if there is any guidance on creating a linker file for Microsoft Extensions? Disabling the linker has it's own issues. |
We have this: https://docs.microsoft.com/en-us/xamarin/ios/deploy-test/linker?tabs=macos#controlling-the-linker, but nothing specific for Microsoft.Extensions. |
@rolfbjarne Thanks for the link. It should also be noted that Microsoft documentation says to submit a bug to this repository if your application requires "Don't Link" in order to run:
I noticed that this item was added to "Future" milestone. Since this item is closed will this be updated to track any progress? |
Yes, that's correct, but that doesn't necessarily mean that the bug is in the code in this repository. The diagnosis I did showed that the bug is in the Entity.Framework code, and I found an issue already open in that repository, which means this bug can be closed (and discussion should continue in the EF issue).
No, subscribe to the EF issue (dotnet/efcore#10963) to get updates. |
When running Xamarin iOS with EF Core release builds of iOS crash if you attempt to use the DbContext. App center logs two exceptions the first silently in unhandled exceptions handler the second crashes the app when attempting to use the context. Code works fine in Android or if the Debug version of the code is used.
Using Xamarin.Forms version 4.8.01451
Logged using the exception handlers in AppDelegate:
ILEmitResolverBuilder.BuildTypeNoCache (Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceCallSite callSite)
System.PlatformNotSupportedException: Operation is not supported on this platform.
Exception from using context:
Enumerable.Single[TSource] (System.Collections.Generic.IEnumerable
1[T] source, System.Func
2[T,TResult] predicate)System.TypeInitializationException: Sequence contains no matching element
This appears to be the specific reason for the issue but there is no work around or resolution:
dotnet/runtime#35988
Steps to Reproduce
Expected Behavior
App Launches
Actual Behavior
App crashes
Environment
Microsoft Visual Studio Enterprise 2019
Version 16.7.3
VisualStudio.16.Release/16.7.3+30503.244
Microsoft .NET Framework
Version 4.8.03752
Installed Version: Enterprise
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
Xamarin 16.7.000.440 (d16-7@358f3c6)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 16.7.0.495 (remotes/origin/d16-7@79c0c522c)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 16.7.85 (1bcbbdf)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 11.0.2.0 (d16-7/025fde9)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: 83105ba
Java.Interop: xamarin/java.interop/d16-7@1f3388a
ProGuard: Guardsquare/proguard@ebe9000
SQLite: xamarin/sqlite@1a3276b
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-7@017078f
Xamarin.iOS and Xamarin.Mac SDK 13.20.2.2 (817b6f7)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Build Logs
https://gist.github.com/rlasker-b2w/eb8cdd49435354e50369b74e116f13fc
Example Project (If Possible)
N/A
The text was updated successfully, but these errors were encountered: