Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Merge branch '5.0.0' into fix-12150
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuarezruiz committed Jun 16, 2021
2 parents bafd005 + ae8e52f commit 4c6ffb6
Show file tree
Hide file tree
Showing 255 changed files with 8,498 additions and 2,242 deletions.
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"cake.tool": {
"version": "1.0.0",
"commands": [
"dotnet-cake"
]
}
}
}
23 changes: 23 additions & 0 deletions .github/workflows/backport-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Backport Trigger

on:
issue_comment:
types: [created]

jobs:
launchBackportBuild:
runs-on: ubuntu-latest
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '@vs-mobiletools-engineering-service2 backport')

steps:
- uses: xamarin/backport-bot-action@v1.0
with:
pull_request_url: ${{ github.event.issue.pull_request.url }}
comment_body: ${{ github.event.comment.body }}
comment_author: ${{ github.actor }}
github_repository: ${{ github.repository }}
ado_organization: ${{ secrets.ADO_PROJECTCOLLECTION }}
ado_project: ${{ secrets.ADO_PROJECT }}
backport_pipeline_id: ${{ secrets.BACKPORT_PIPELINEID }}
ado_build_pat: ${{ secrets.ADO_BUILDPAT }}
github_account_pat: ${{ secrets.SERVICEACCOUNT_PAT }}
22 changes: 22 additions & 0 deletions .github/workflows/rebase-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Rebase Trigger

on:
issue_comment:
types: [created]

jobs:
launchBackportBuild:
runs-on: ubuntu-latest
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '@vs-mobiletools-engineering-service2 rebase')

steps:
- uses: xamarin/rebase-bot-action@v1.0
with:
pull_request_url: ${{ github.event.issue.pull_request.url }}
comment_author: ${{ github.actor }}
github_repository: ${{ github.repository }}
ado_organization: ${{ secrets.ADO_PROJECTCOLLECTION }}
ado_project: ${{ secrets.ADO_PROJECT }}
rebase_pipeline_id: 13926
ado_build_pat: ${{ secrets.ADO_BUILDPAT }}
github_account_pat: ${{ secrets.SERVICEACCOUNT_PAT }}
2 changes: 1 addition & 1 deletion .nuspec/Xamarin.Forms.Visual.Material.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<group targetFramework="MonoAndroid10.0">
<dependency id="Xamarin.AndroidX.Lifecycle.LiveData" version="2.2.0.4" />
<dependency id="Xamarin.Google.Android.Material" version="1.1.0.5" />
<dependency id="Xamarin.Google.Android.Material" version="1.2.1.1" />
</group>
<group targetFramework="Xamarin.iOS10">
<dependency id="Xamarin.iOS.MaterialComponents" version="92.0.0"/>
Expand Down
3 changes: 2 additions & 1 deletion .nuspec/Xamarin.Forms.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
<dependencies>
<group targetFramework="MonoAndroid10.0">
<dependency id="Xamarin.AndroidX.Lifecycle.LiveData" version="2.2.0.4" />
<dependency id="Xamarin.Google.Android.Material" version="1.1.0.5" />
<dependency id="Xamarin.Google.Android.Material" version="1.2.1.1" />
<dependency id="Xamarin.AndroidX.Legacy.Support.V4" version="1.0.0.6" />
<dependency id="Xamarin.AndroidX.Browser" version="1.3.0" />
<dependency id="Xamarin.AndroidX.Navigation.UI" version="2.3.2.1" />
</group>
<group targetFramework="uap10.0.14393">
<dependency id="NETStandard.Library" version="2.0.1"/>
Expand Down
4 changes: 2 additions & 2 deletions DevopsNuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<configuration>
<packageSources>
<clear/>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" protocolVersion="3" />
<add key="nightly" value="https://aka.ms/xf-ci/index.json" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" protocolVersion="3" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<add key="nuget" value="../s/Nuget" />
</packageSources>
<activePackageSource>
Expand Down
2 changes: 1 addition & 1 deletion DualScreen/DualScreen.Android/DualScreen.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.2.0.4" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.1.0.5" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.2.1.1" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.6" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion EmbeddingTestBeds/Embedding.Droid/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.3.0" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.1.0.1" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.1.0.5" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.2.1.1" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.1" />
</ItemGroup>
</Project>
7 changes: 0 additions & 7 deletions NuGet.config

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<ItemGroup Condition="'$(TargetFramework)' == 'MonoAndroid10.0'">
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.2.0.4" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.6" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.1.0.5" />
<PackageReference Include="Xamarin.AndroidX.RecyclerView" Version="1.1.0.5" />
<PackageReference Include="Xamarin.AndroidX.RecyclerView" Version="1.1.0.6" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.2.1.1" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Xamarin.Forms.Build.Tasks;
Expand All @@ -13,7 +14,7 @@ class RDSourceTypeConverter : ICompiledTypeConverter
{
public IEnumerable<Instruction> ConvertFromString(string value, ILContext context, BaseNode node)
{
var module = context.Body.Method.Module;
var currentModule = context.Body.Method.Module;
var body = context.Body;

INode rootNode = node;
Expand All @@ -22,7 +23,23 @@ public IEnumerable<Instruction> ConvertFromString(string value, ILContext contex

var rdNode = node.Parent as IElementNode;

var rootTargetPath = XamlCTask.GetPathForType(module, ((ILRootNode)rootNode).TypeReference);
var rootTargetPath = XamlCTask.GetPathForType(currentModule, ((ILRootNode)rootNode).TypeReference);

var module = currentModule;
string asmName = null;
if (value.Contains(";assembly="))
{
var parts = value.Split(new[] { ";assembly=" }, StringSplitOptions.RemoveEmptyEntries);
value = parts[0];
asmName = parts[1];
if (currentModule.Assembly.Name.Name != asmName)
{
var ar = currentModule.AssemblyReferences.FirstOrDefault(ar => ar.Name == asmName);
if (ar == null)
throw new BuildException(BuildExceptionCode.ResourceMissing, node, null, value);
module = currentModule.AssemblyResolver.Resolve(ar).MainModule;
}
}
var uri = new Uri(value, UriKind.Relative);

var resourcePath = ResourceDictionary.RDSourceTypeConverter.GetResourcePath(uri, rootTargetPath);
Expand All @@ -36,25 +53,38 @@ public IEnumerable<Instruction> ConvertFromString(string value, ILContext contex

//abuse the converter, produce some side effect, but leave the stack untouched
//public void SetAndLoadSource(Uri value, string resourceID, Assembly assembly, System.Xml.IXmlLineInfo lineInfo)
foreach (var instruction in context.Variables[rdNode].LoadAs(module.GetTypeDefinition(resourceDictionaryType), module))
foreach (var instruction in context.Variables[rdNode].LoadAs(currentModule.GetTypeDefinition(resourceDictionaryType), currentModule))
yield return instruction;
//reappend assembly= in all cases, see other RD converter
if (!string.IsNullOrEmpty(asmName))
value = $"{value};assembly={asmName}";
else
value = $"{value};assembly={((ILRootNode)rootNode).TypeReference.Module.Assembly.Name.Name}";
foreach (var instruction in (new UriTypeConverter()).ConvertFromString(value, context, node))
yield return instruction; //the Uri

//keep the Uri for later
yield return Create(Dup);
var uriVarDef = new VariableDefinition(module.ImportReference(("System", "System", "Uri")));
var uriVarDef = new VariableDefinition(currentModule.ImportReference(("System", "System", "Uri")));
body.Variables.Add(uriVarDef);
yield return Create(Stloc, uriVarDef);
yield return Create(Ldstr, resourcePath); //resourcePath
yield return Create(Ldtoken, module.ImportReference(((ILRootNode)rootNode).TypeReference));
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
yield return Create(Call, module.ImportMethodReference(("mscorlib", "System.Reflection", "IntrospectionExtensions"), methodName: "GetTypeInfo", parameterTypes: new[] { ("mscorlib", "System", "Type") }, isStatic: true));
yield return Create(Callvirt, module.ImportPropertyGetterReference(("mscorlib", "System.Reflection", "TypeInfo"), propertyName: "Assembly", flatten: true));

if (!string.IsNullOrEmpty(asmName))
{
yield return Create(Ldstr, asmName);
yield return Create(Call, currentModule.ImportMethodReference(("mscorlib", "System.Reflection", "Assembly"), methodName: "Load", parameterTypes: new[] { ("mscorlib", "System", "String") }, isStatic: true));
}
else //we could use assembly.Load in the 'else' part too, but I don't want to change working code right now
{
yield return Create(Ldtoken, currentModule.ImportReference(((ILRootNode)rootNode).TypeReference));
yield return Create(Call, currentModule.ImportMethodReference(("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true));
yield return Create(Call, currentModule.ImportMethodReference(("mscorlib", "System.Reflection", "IntrospectionExtensions"), methodName: "GetTypeInfo", parameterTypes: new[] { ("mscorlib", "System", "Type") }, isStatic: true));
yield return Create(Callvirt, currentModule.ImportPropertyGetterReference(("mscorlib", "System.Reflection", "TypeInfo"), propertyName: "Assembly", flatten: true));
}
foreach (var instruction in node.PushXmlLineInfo(context))
yield return instruction; //lineinfo
yield return Create(Callvirt, module.ImportMethodReference(resourceDictionaryType,
yield return Create(Callvirt, currentModule.ImportMethodReference(resourceDictionaryType,
methodName: "SetAndLoadSource",
parameterTypes: new[] { ("System", "System", "Uri"), ("mscorlib", "System", "String"), ("mscorlib", "System.Reflection", "Assembly"), ("System.Xml.ReaderWriter", "System.Xml", "IXmlLineInfo") }));
//ldloc the stored uri as return value
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ protected override void UpdateMenuItemIcon(Context context, IMenuItem menuItem,
if (toolBarItem.IconImageSource is FileImageSource fileImageSource)
{
var name = IOPath.GetFileNameWithoutExtension(fileImageSource.File);
var id = Xamarin.Forms.Platform.Android.ResourceManager.GetDrawableByName(name);
var id = context.GetDrawableId(name);
if (id != 0)
{
if ((int)Build.VERSION.SdkInt >= 21)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.2.0.4" />
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.3.0" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.1.0.5" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.2.1.1" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.6" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.6" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,17 @@ protected override void OnCreate(Bundle bundle)
#else
Forms.SetFlags("UseLegacyRenderers");
#endif
// Forms.SetFlags("AccessibilityExperimental");
Forms.Init(this, bundle);



// null out the assembly on the Resource Manager
// so all of our tests run without using the reflection APIs
// At some point the Resources class types will go away so
// reflection will stop working
ResourceManager.Init(null);

FormsMaps.Init(this, bundle);
FormsMaterial.Init(this, bundle);
AndroidAppLinks.Init(this);
Expand Down
2 changes: 1 addition & 1 deletion Xamarin.Forms.ControlGallery.Android/Nuget.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.1.0" />
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.3.0" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.1.0.5" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.2.1.1" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@
<Version>12.0.3</Version>
</PackageReference>
<PackageReference Include="NUnit">
<Version>3.12.0</Version>
<Version>3.13.1</Version>
</PackageReference>
<PackageReference Include="Xam.Plugin.DeviceInfo">
<Version>3.0.2</Version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
<Version>12.0.3</Version>
</PackageReference>
<PackageReference Include="NUnit">
<Version>3.12.0</Version>
<Version>3.13.1</Version>
</PackageReference>
<PackageReference Include="Xam.Plugin.DeviceInfo">
<Version>3.0.2</Version>
Expand Down
20 changes: 20 additions & 0 deletions Xamarin.Forms.ControlGallery.iOS/CustomRenderers.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using CoreGraphics;
using CoreLocation;
using Foundation;
using MapKit;
Expand All @@ -25,8 +26,27 @@
[assembly: ExportRenderer(typeof(Issue1683.EntryKeyboardFlags), typeof(EntryRendererKeyboardFlags))]
[assembly: ExportRenderer(typeof(Issue1683.EditorKeyboardFlags), typeof(EditorRendererKeyboardFlags))]
[assembly: ExportRenderer(typeof(Issue5830.ExtendedEntryCell), typeof(ExtendedEntryCellRenderer))]
[assembly: ExportRenderer(typeof(Issue13390), typeof(Issue13390Renderer))]
namespace Xamarin.Forms.ControlGallery.iOS
{
public class Issue13390Renderer : ShellRenderer
{
protected override IShellFlyoutRenderer CreateFlyoutRenderer()
{
return new ShellFlyoutRenderer()
{
FlyoutTransition = new SlideFlyoutTransition2()
};
}

public class SlideFlyoutTransition2 : IShellFlyoutTransition
{
public void LayoutViews(CGRect bounds, nfloat openPercent, UIView flyout, UIView shell, FlyoutBehavior behavior)
{
flyout.Frame = new CGRect(0, 0, 0, 0);
}
}
}

public class CustomIOSMapRenderer : ViewRenderer<Bugzilla39987.CustomMapView, MKMapView>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
<PackageReference Include="AdvancedColorPicker" Version="2.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NUnit">
<Version>3.12.0</Version>
<Version>3.13.1</Version>
</PackageReference>
<PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.0.2" />
<PackageReference Include="Xamarin.Insights" Version="1.12.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected override void Init()
Content = new StackLayout { Children = { label, listView, listView2, listView3 } };
}

#if (UITEST && __IOS__)
#if UITEST && __IOS__
[Test]
public void Bugzilla43161Test()
{
Expand All @@ -66,4 +66,4 @@ public void Bugzilla43161Test()
}
#endif
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Xamarin.Forms.CustomAttributes;
using System.Collections.Generic;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Shapes;
using System.Collections.Generic;

#if UITEST
using Xamarin.Forms.Core.UITests;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

#if UITEST
using Xamarin.Forms.Core.UITests;
using Xamarin.UITest;
using NUnit.Framework;
#endif

namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.ManualReview)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 12259, "App crash when rendering label with FormattedText", PlatformAffected.macOS)]
public class Issue12259 : TestContentPage // or TestFlyoutPage, etc ...
{
protected override void Init()
{
var label = new Label();

var fs = new FormattedString();

fs.Spans.Add(new Span { Text = "Learn more at " });

fs.Spans.Add(new Span { Text = "https://aka.ms/xamarin-quickstart ", FontAttributes = FontAttributes.Bold });

label.FormattedText = fs;

Content = label;
}
}
}

0 comments on commit 4c6ffb6

Please sign in to comment.