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

Updating Xamarin sample with proper linker settings #2702

Merged
merged 3 commits into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions entity-framework/core/get-started/xamarin.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ The following sections will walk you through the code in the sample project that

It is assumed that you are familiar with the Xamarin.Forms topics of [displaying data](/xamarin/xamarin-forms/app-fundamentals/data-binding/) and [navigating between pages](/xamarin/xamarin-forms/app-fundamentals/navigation/).

> [!IMPORTANT]
> Entity Framework Core uses reflection to invoke functions which the Xamarin.iOS linker may strip out while in **Release** mode configurations. You can avoid that in one of two ways.
>
> * The first is to add `--linkskip System.Core` to the **Additional mtouch arguments** in the **iOS Build** options.
> * Alternatively set the Xamarin.iOS **Linker behavior** to `Don't Link` in the **iOS Build** options.
> [This article explains more about the Xamarin.iOS linker](/xamarin/ios/deploy-test/linker) including how to set the behavior on Xamarin.iOS.
>

## Entity Framework Core NuGet packages

To create Xamarin.Forms apps with EF Core, you install the package for the EF Core database provider(s) you want to target into all of the projects in the Xamarin.Forms solution. This tutorial uses the SQLite provider.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,18 @@
<MtouchArch>x86_64</MtouchArch>
<MtouchLink>None</MtouchLink>
<MtouchDebug>true</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>None</MtouchLink>
<MtouchLink>SdkOnly</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchExtraArgs>--linkskip System.Core</MtouchExtraArgs>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -63,6 +65,8 @@
<CodesignKey>iPhone Developer</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<CodesignExtraArgs>--interpreter</CodesignExtraArgs>
<MtouchLink>SdkOnly</MtouchLink>
<MtouchExtraArgs>--linkskip System.Core</MtouchExtraArgs>
</PropertyGroup>
<ItemGroup>
<Compile Include="Main.cs" />
Expand Down
3 changes: 3 additions & 0 deletions samples/core/Xamarin/EFGetStarted.iOS/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using Foundation;
using UIKit;



namespace EFGetStarted.iOS
{
public class Application
Expand All @@ -15,6 +17,7 @@ static void Main(string[] args)
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, "AppDelegate");

}
}
}