Synchronize the XSF with Xamarin.Form (#159)
author유리나/Common Platform Lab(SR)/Staff Engineer/삼성전자 <rina6350.you@samsung.com>
Mon, 23 Mar 2020 04:54:59 +0000 (13:54 +0900)
committer안주원/Common Platform Lab(SR)/Principal Engineer/삼성전자 <juwon.ahn@samsung.com>
Mon, 23 Mar 2020 04:54:59 +0000 (13:54 +0900)
commitf7ba5af6d1fbcba6003bdc75dbb48e7ecfcd3044
tree762fad48a64ccab860c4366f7f086431f7339262
parent6fa122f6cc5441774bc75e3d3459c3fde2675171
Synchronize the XSF with Xamarin.Form (#159)

* [Core] Removed null values from the DisplayActionSheet  (#8445) fixes #4744

* Fixed IndicatorView issue resetting the template when data updates (#8709)

* Fixed IndicatorView template resets when data updates

* Fixed failing UITests

* Undo unnecessary changes in the ControlGallery Android csproj

* Removed unnecessary changes in the ControlGallery Android csproj

* Fix wrong ControlGallery Android csproj

* [Tizen] Implement DisplayPromptAsync for Tizen (#8820) fixes #6713

* Implement DisplayPromptAsync in Tizen

* Update Xamarin.Forms.Platform.Tizen/Platform.cs

Fix BackButtonPressed handler

Co-Authored-By: campersau <buchholz.bastian@googlemail.com>
* Queue DisplayPromptAsync for display after pages loads; fixes #8526 (#8788) fixes #8526

* Custom/Embedded fonts (#6013)

* Android fonts now work with shorter notation

"Lobster-Regular.ttf#Lobster-Regular" now works as just "Lobster-Regular"

* iOS Sample page now loads

* UWP now uses simple font names

* Fixed UWP Font loading!

UWP now supports `PTM55FT#PTMono`

* Added UWP Font Caching!

* iOS now supports Custom fonts like `PTM55FT#PTMono`

* Android now supports all the font formats!

* Add new styles to show how they can work

* Android fonts now work with shorter notation

"Lobster-Regular.ttf#Lobster-Regular" now works as just "Lobster-Regular"

* iOS Sample page now loads

* UWP now uses simple font names

* Fixed UWP Font loading!

UWP now supports `PTM55FT#PTMono`

* Added UWP Font Caching!

* iOS now supports Custom fonts like `PTM55FT#PTMono`

* Android now supports all the font formats!

* Add new styles to show how they can work

* Fixed iOS Font Loading

* iOS now can load embedded resources!

* Android can now load from embedded resources

* Moved FontFile parsing to Xamarin.Forms.Core, Added Unit Tests!

* IEmeddedFont now returns the path on success.

* removed unused code

* Embedded fonts now load in UWP

* Fixed crash in fonts

* changed the String.Contains to a string, instead of char to make VS windows happy

* netStandard1.0 won't let me have nice things

* grammer fixes :D

* smidgen of cleanup

* fix merge issues

* Update Registrar.cs

* [Tizen] Creates the GestureDetector on demand (#8874)

* [Xaml] Throw XamlParseException in MarkupExpressionParser.GetNextPiece (#8447)

* [XamlC] Support variance (#8535)

* [Xaml[C]] Accept prefixed property names of markup extensions (#5186)

* [XamlC] Dispose assembly resolver constructed by XamlCTask (#8397)

An assembly resolver holds opened files, and leaks if it is not disposed.
It is problematic if you run Xamarin.Forms.Xaml.UnitTests on Linux with
the default configuration because it has a small limit for the number of
opened files. It may cause stability issues also on other platforms,
depending on the situation.

* Typo Fix and change to nameof (#8942) fixes #8935

* Improve resiliency of Shell when removing/adding items (#9023)

* Add IsVisible property to ShellItem/ShellSection/ShellContent

* - fix formatting

* - simplify interface

* - fix local deploy

* -fixes

* - work

* - check visibility after parent is set

* - fix formatting

* - embedding fix

* - menu item not getting added to Visible Items
- Process Items change on Visible Items

* - fix incorrect cast

* - fix casting

* - fix route testing to not invlude not visible

* - unsubscribe

* - set shell variable

* - remove IsVisible from BaseShellItem

* - fix failing unit test

* [Xaml] Create value from positional argument text of markup extension (#8980)

The behavior introduced with this change conforms to the description of
[MS-XAML-2009] page 80 and 81.
fixes #6905

* [C,X] Resolve indexers on base class (#8968)

- fixes #8936

this was regressed by #7836

* Resolve issues with Shell ToolbarItems not reacting to CanExecute Changes (#8889) fixes #8741 fixes #8327

* Fixing various toolbar item display issues

* - fix csproj file

* - added UI test

* - fix possible breaks with Navigation Page

* Fix for 8741: Assert that ToolbarItem is grayed-out (PR 8889) (#8892)

* Assert that ToolbarItem is grayed-out

* Check alpha values on Android

* - fix toolbar item ordering

* - toolbar tracker improvements

* - remove whitespace

* - just use an array from the get go

* - primary

Co-authored-by: Brian Runck <brunck@users.noreply.github.com>
* [Tizen] Fix back button issue in Shell navigation (#8982)

* [Tizen] Fix back button issue in Shell navigation

* [Tizen] Add navigation/back button click effect

* Enhance LightweightPlatform (#8873)

* [Tizen] Gif Animation Support (#9068) fixes #1704

* [core] perf improvements for Assembly attributes reflection (#8938)

When profiling startup, I started looking into the number of calls
retrieving custom attributes from assemblies:

    Method call summary
    Total(ms) Self(ms)      Calls Method name
          24        0         301 System.Reflection.RuntimeAssembly:GetCustomAttributes (System.Type,bool)

I saw a pattern such as:

    object[] attributes = assembly.GetCustomAttributes(attrType, true);
    var handlerAttributes = new HandlerAttribute[attributes.Length];
    Array.Copy(attributes, handlerAttributes, attributes.Length);
    RegisterRenderers(handlerAttributes);

We can avoid the allocation and copying of the array completely here.
We can simply cast `attributes` to `HandlerAttribute[]`.

The other thing I saw was:

    string resolutionName = assembly.FullName;
    var resolutionNameAttribute = (ResolutionGroupNameAttribute)assembly.GetCustomAttribute(typeof(ResolutionGroupNameAttribute));
    if (resolutionNameAttribute != null)
        resolutionName = resolutionNameAttribute.ShortName;

This was happening even if the assembly had no `[assembly:Effect]`.

I reordered the code to not look for `[assembly: ResolutionGroupName]`
unless there was an `[assembly: Export]`.

This reduced the calls to `GetCustomAttributes` to:

    Method call summary
    Total(ms) Self(ms)      Calls Method name
          21        0         251 System.Reflection.RuntimeAssembly:GetCustomAttributes (System.Type,bool)

I also did a small amount of refactoring:

* `ReflectionExtensions.GetCustomAttributesSafe` had a variable
  declaration that could be removed.
* `ReflectionExtensions.GetCustomAttributesSafe` was a nice wrapper to
  avoid `#if` and also has a `try-catch` for the previewer. I used
  this in places where there was duplicated code.

~~ Results ~~

    Before:
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    12-17 13:08:57.119  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +588ms
    12-17 13:09:00.852  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +583ms
    12-17 13:09:04.602  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +573ms
    12-17 13:09:08.388  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +581ms
    12-17 13:09:12.137  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +576ms
    12-17 13:09:15.887  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +583ms
    12-17 13:09:19.621  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +578ms
    12-17 13:09:23.388  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +588ms
    12-17 13:09:27.123  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +587ms
    12-17 13:09:30.892  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +571ms
    Average(ms): 580.8
    Std Err(ms): 1.94250697124446
    Std Dev(ms): 6.1427463998877

    After:
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    Launching: com.xamarin.forms.helloforms
    12-17 13:10:29.762  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +579ms
    12-17 13:10:33.514  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +572ms
    12-17 13:10:37.263  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +564ms
    12-17 13:10:40.996  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +572ms
    12-17 13:10:44.748  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +569ms
    12-17 13:10:48.467  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +573ms
    12-17 13:10:52.231  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +577ms
    12-17 13:10:55.981  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +558ms
    12-17 13:10:59.765  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +574ms
    12-17 13:11:03.499  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +569ms
    Average(ms): 570.7
    Std Err(ms): 1.94393644157644
    Std Dev(ms): 6.1472667819844

I think this saves ~10ms on startup on Android, but this should help
all platforms.

These numbers were taken running on a Pixel 3 XL, a Blank
Xamarin.Forms app template using Xamarin.Forms/master.

Using: https://github.com/xamarin/Xamarin.Forms/pull/8867

* [core] improve Color & Clamp performance (#8884)

* [core] improve Color & Clamp performance

When profiling startup of a HelloForms app on a Pixel 3 XL, I noticed:

    Total(ms) Self(ms)      Calls Method name
            3        1        572 Xamarin.Forms.Internals.NumericExtensions:Clamp (double,double,double)

This method is called multiple times for every `Color` created and
~142 are created on startup. This is why it shows up 572 times for an
app with a single `Label`.

I found there is a `Math.Clamp` implementation in corefx:

https://github.com/dotnet/runtime/blob/6662a0f2fd05298af1f9b1b020fa526595f336f7/src/libraries/System.Private.CoreLib/src/System/Math.cs#L224-L225

The only difference is this version can throw an exception, so we
could return the incoming value instead. That would be bad to change!

If I rework `NumericExtensions` to use corefx's implementation it is a
bit faster, I did a BenchmarkDotNet comparison running with Mono on
macOS:

     Method |      Mean |    Error |   StdDev |
    ------- |----------:|---------:|---------:|
     Clamp2 |  53.89 ns | 0.668 ns | 0.522 ns |
     Clamp1 |  61.84 ns | 1.270 ns | 2.289 ns |
     Color2 | 112.50 ns | 2.643 ns | 3.705 ns |
     Color1 | 129.03 ns | 2.603 ns | 4.760 ns |

Maybe every `Color` is ~13% faster?

Code for the benchmark is here:

https://github.com/jonathanpeppers/Benchmarks/blob/clamp/Benchmarks/Clamp.cs

Additionally, I reworked the list of default `Color` fields so that
they call a new private constructor that does less math and avoids
`Clamp` completely. We should still keep the original change, as it
would help any cases where the `Color.To*` methods would be used in
apps.

I seem to be able to see a small difference in a Release build running
on a Pixel 3 XL:

    Before:
    12-18 13:04:27.154  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +606ms
    12-18 13:04:30.851  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +589ms
    12-18 13:04:34.601  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +587ms
    12-18 13:04:38.352  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +575ms
    12-18 13:04:42.084  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +583ms
    12-18 13:04:45.802  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +573ms
    12-18 13:04:49.566  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +592ms
    12-18 13:04:53.284  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +583ms
    12-18 13:04:57.015  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +594ms
    12-18 13:05:00.715  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +581ms
    Average(ms): 586.3
    Std Err(ms): 3.05886689260364
    Std Dev(ms): 9.67298643990917

    After:
    12-18 13:08:16.677  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +593ms
    12-18 13:08:20.377  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +577ms
    12-18 13:08:24.107  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +583ms
    12-18 13:08:27.827  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +576ms
    12-18 13:08:31.574  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +586ms
    12-18 13:08:35.324  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +584ms
    12-18 13:08:39.056  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +587ms
    12-18 13:08:42.773  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +586ms
    12-18 13:08:46.523  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +584ms
    12-18 13:08:50.256  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +587ms
    Average(ms): 584.3
    Std Err(ms): 1.56382721409865
    Std Dev(ms): 4.94525586350753

This change seems low risk and would help all platforms.

* One last tweak byte -> int

Doing some reading: https://stackoverflow.com/a/43158214/132442

It seems `int` performs even better than `byte`. I did another test
run with just this change:

    Before:
    12-18 13:37:23.347  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +576ms
    12-18 13:37:27.079  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +575ms
    12-18 13:37:30.828  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +581ms
    12-18 13:37:34.578  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +588ms
    12-18 13:37:38.296  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +572ms
    12-18 13:37:42.046  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +579ms
    12-18 13:37:45.781  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +576ms
    12-18 13:37:49.526  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +586ms
    12-18 13:37:53.276  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +586ms
    12-18 13:37:57.009  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +582ms
    Average(ms): 580.1
    Std Err(ms): 1.70912583243924
    Std Dev(ms): 5.40473043833928

    After:
    12-18 13:35:38.745  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +572ms
    12-18 13:35:42.459  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +572ms
    12-18 13:35:46.209  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +581ms
    12-18 13:35:49.974  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +581ms
    12-18 13:35:53.724  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +574ms
    12-18 13:35:57.474  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +580ms
    12-18 13:36:01.207  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +573ms
    12-18 13:36:04.957  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +568ms
    12-18 13:36:08.707  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +566ms
    12-18 13:36:12.407  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +565ms
    Average(ms): 573.2
    Std Err(ms): 1.87853370714738
    Std Dev(ms): 5.94044517598546

* Fixed the conflict of Registrar.cs

* Detect when pages are popped from clicking on tab (#9086)

* Fixed the conflict shell

* send remove events (#9124)

* [Tizen] Shell: FlyoutBackgroundImage, FlyoutBackgroundImageAspect (#8905)

* [Tizen] Add BackgroundImage properties in NavigationView

* [Tizen] Update INavigationView interface

* [Tizen] Remove unused attribute and namespace

* [Tizen] Update MaterialNavigationView
fixes #4410

* Added IconColor property for managing navigation icon color (#5185)

Co-authored-by: Samantha Houts <samhouts@users.noreply.github.com>
* [android/ios] improve perf when not using Application.Properties (#8887)

* [android/ios] improve perf when not using Application.Properties

When profiling startup, I was seeing things like:

    Method call summary
    Total(ms) Self(ms)      Calls Method name
          52        0          3 System.IO.IsolatedStorage.IsolatedStorageFile:GetUserStoreForApplication ()
          52        0          3 (wrapper remoting-invoke-with-check) System.IO.IsolatedStorage.IsolatedStorageFile:PostInit ()
          51        0          3 System.IO.IsolatedStorage.IsolatedStorageFile:PostInit ()
          51        0          2 (wrapper remoting-invoke-with-check) System.IO.IsolatedStorage.IsolatedStorageFile:FileExists (string)
          51        0          2 System.IO.IsolatedStorage.IsolatedStorageFile:FileExists (string)
          49        0          4 System.IO.IsolatedStorage.IsolatedStorageFile:IsPathInStorage (string)

This app has no `Properties` at all, but it seems to still be doing
the file I/O for it.

I found that a file was being written that contain a serialized empty
dictionary:

    > adb shell run-as com.xamarin.forms.helloforms cat /data/user/0/com.xamarin.forms.helloforms/files/.config/.isolated-storage/PropertyStore.forms
    @▲ArrayOfKeyValueOfstringanyTyp9http://schemas.microsoft.com/2003/10/Serialization/Arrays       ☺i)http://www.w3.org/2001/XMLSchema-instance☺

Any subsequent startup would parse this file.

Two changes will help here:

1) For writes, use a single instance of:

    using (var store = IsolatedStorageFile.GetUserStoreForApplication())

It appears this call is expensive.

2) On writes, we don't need to write a file at all if the `Properties`
   dictionary is empty and no file is on disk. This way apps that
   don't use `Properties` at all won't load a file with an empty
   dictionary.

~~ Results ~~

Using a Release build of the Blank Forms app template on a Pixel 3 XL:

    Before:
    12-13 14:01:42.826  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +606ms
    12-13 14:01:46.541  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +588ms
    12-13 14:01:50.325  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +597ms
    12-13 14:01:54.088  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +600ms
    12-13 14:01:57.855  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +579ms
    12-13 14:02:01.619  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +594ms
    12-13 14:02:05.371  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +605ms
    12-13 14:02:09.106  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +597ms
    12-13 14:02:12.869  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +600ms
    12-13 14:02:16.635  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +601ms
    Average(ms): 596.7
    Std Err(ms): 2.56493448042808
    Std Dev(ms): 8.11103500725332
    After:
    12-13 13:59:46.260  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +600ms
    12-13 13:59:49.993  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +579ms
    12-13 13:59:53.739  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +587ms
    12-13 13:59:57.506  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +592ms
    12-13 14:00:01.255  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +586ms
    12-13 14:00:05.007  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +580ms
    12-13 14:00:08.841  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +581ms
    12-13 14:00:12.587  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +591ms
    12-13 14:00:16.320  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +585ms
    12-13 14:00:20.052  1490  1517 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +577ms
    Average(ms): 585.8
    Std Err(ms): 2.23507394856536
    Std Dev(ms): 7.06792441637257

I think this change saves ~10ms on startup for apps that don't use
`Application.Properties` at all.

I made this change for Android & iOS, as they had similar
implementations.

* Moved the properties check earlier

This way it won't even open the Stream on writes when there are no
properties.

* [tizen] include the same optimization

As suggested by @rookiejava:

https://github.com/xamarin/Xamarin.Forms/pull/8887#pullrequestreview-332378887

* [tizen] make implementation match Android exactly

Context: https://github.com/xamarin/Xamarin.Forms/pull/8887#discussion_r359089505

As suggested by @rookiejava, we can make the implementation match
other platforms exactly.

I took the changes as-is, except matched the formatting in Android's
`Deserializer.cs` so the two files are identical except for the
namespace. I also had to use `Internals.Log`.

* Add null check to GetIconColor (#9172)

* [Tizen] Supports Custom/Embedded and System fonts (#9138)

* Update GitInfo.txt

* fix Profile FrameEnd call (#9117)

* Fix SeachBarRenderer CreateNativeControl issue (#8946)

* [Tizen] Supports Custom/Embedded and System fonts

Co-authored-by: Samantha Houts <samhouts@users.noreply.github.com>
Co-authored-by: Shane Neuville <shane94@hotmail.com>
Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: TingtingAn <antingting2009@qq.com>
* [Core] performance improvements around bindings (#9114)

I made most of these changes through the benchmarks here:

https://github.com/jonathanpeppers/Benchmarks/blob/6725a72844c5f18320a31223b6f37abd7b28ece4/Benchmarks/BindingBenchmarks.cs

1. `Clone()` was doing `new Binding()` but then using the property
   setters instead of the ctor parameters. `Clone()` seems to be
   called for `DataTemplate`, `ListView`, etc.

2. `BindingBase.ThrowIfApplied()` is called very frequently, so I
   added `MethodImplOptions.AggressiveInlining`.

3. `BindingBaseExtensions.GetRealizedMode` is called ~3 times per
   binding applied, added `MethodImplOptions.AggressiveInlining`.

4. In `BindingExpression` a `bool isLast` value was always calculated,
   even though it was only sometimes used inside an `if`. It can just
   do this check inside the `if`.

5. `object value = property.DefaultValue;` was defined prior to
   calling `TryGetValue`, which will always overwrite it. I just
   removed the call, since a Roslyn analyzer was showing me this.

6. `BindingExpression` was doing a `string.Split('.')` which always
   allocates a `char[]`. I defined the array as a `static` field
   instead.

7. `BindingExpression.GetPart` used `IEnumerable` and `yield return`.
   In the most common case, this function returned a single item and
   in the rare case two items. I removed this function and a `foreach`
   and moved logic inline within the `ParsePath` method. This avoids
   allocations around `foreach`, when it isn't needed.

These are all small changes, but I was only able to see some
difference after everything came together. If we need to split some of
these up, we can do that.

~~ Results ~~

Benchmarks running on mono/macOS:

    BenchmarkDotNet=v0.11.3, OS=macOS Mojave 10.14.6 (18G95) [Darwin 18.7.0]
    Intel Core i7-6567U CPU 3.30GHz (Skylake), 1 CPU, 4 logical and 2 physical cores
      [Host]     : Mono 6.6.0.155 (2019-08/296a9afdb24 Thu), 64bit
      DefaultJob : Mono 6.6.0.155 (2019-08/296a9afdb24 Thu), 64bit
             Method |        Mean |      Error |     StdDev |      Median |
    --------------- |------------:|-----------:|-----------:|------------:|
        CtorSingle2 |    355.9 ns |   2.600 ns |   2.432 ns |    356.1 ns |
        CtorSingle1 |    447.0 ns |  28.825 ns |  29.601 ns |    432.4 ns |
      CtorMultiple2 |  1,316.6 ns |   7.092 ns |   6.287 ns |  1,316.6 ns |
      CtorMultiple1 |  1,611.0 ns |  77.914 ns | 109.225 ns |  1,560.9 ns |
             Clone2 |  2,670.6 ns |  38.075 ns |  33.753 ns |  2,655.7 ns |
             Clone1 |  3,154.3 ns |  15.010 ns |  14.040 ns |  3,151.7 ns |
       ApplySingle2 |  8,065.5 ns |  87.537 ns |  77.599 ns |  8,071.3 ns |
       ApplySingle1 |  8,555.2 ns | 183.373 ns | 508.126 ns |  8,268.9 ns |
     ApplyMultiple2 | 28,933.1 ns | 252.589 ns | 236.272 ns | 28,937.1 ns |
     ApplyMultiple1 | 29,388.9 ns | 269.263 ns | 251.868 ns | 29,296.0 ns |

This appears to save 0.5-1ms per binding applied. It is also somewhat
concerning that this shows a complex binding takes ~30ms on mono? I
will look into that further.

Benchmarks running on Windows/.NET framework, allow us to see the
memory usage as well (memory usage not implemented in BDN on mono):

    BenchmarkDotNet=v0.11.3, OS=Windows 10.0.18362
    Intel Core i9-9900K CPU 3.60GHz, 1 CPU, 16 logical and 8 physical cores
      [Host]     : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.8.4075.0
      DefaultJob : .NET Framework 4.7.2 (CLR 4.0.30319.42000), 32bit LegacyJIT-v4.8.4075.0
             Method |       Mean |      Error |     StdDev | Allocated Memory/Op |
    --------------- |-----------:|-----------:|-----------:|--------------------:|
        CtorSingle2 |   122.6 ns |  0.5047 ns |  0.4721 ns |               369 B |
        CtorSingle1 |   156.3 ns |  0.5229 ns |  0.4636 ns |               421 B |
      CtorMultiple2 |   337.7 ns |  2.5286 ns |  2.3652 ns |               857 B |
      CtorMultiple1 |   435.4 ns |  1.0472 ns |  0.9796 ns |              1017 B |
             Clone2 |   667.0 ns |  2.5739 ns |  2.0095 ns |              1715 B |
             Clone1 |   890.6 ns |  9.1459 ns |  8.5551 ns |              2035 B |
       ApplySingle2 | 1,512.4 ns |  9.0686 ns |  7.0802 ns |               521 B |
       ApplySingle1 | 1,655.3 ns | 31.1960 ns | 35.9253 ns |               573 B |
     ApplyMultiple2 | 4,501.1 ns | 21.8014 ns | 20.3930 ns |              1394 B |
     ApplyMultiple1 | 4,510.7 ns | 25.4709 ns | 22.5793 ns |              1554 B |

This looks like it saves ~160 bytes of allocations per binding applied.

I also tested the Blank Forms app template after adding 100 `Label`
with a single binding:

    Before:
    01-13 16:23:09.406  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +746ms
    01-13 16:23:13.103  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +716ms
    01-13 16:23:16.888  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +732ms
    01-13 16:23:20.656  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +728ms
    01-13 16:23:24.390  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +726ms
    01-13 16:23:28.192  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +723ms
    01-13 16:23:31.910  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +725ms
    01-13 16:23:35.660  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +726ms
    01-13 16:23:39.410  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +728ms
    01-13 16:23:43.126  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +724ms
    Average(ms): 727.4
    Std Err(ms): 2.44585817704589
    Std Dev(ms): 7.73448267321236

    After:
    01-13 16:26:21.557  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +732ms
    01-13 16:26:25.294  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +716ms
    01-13 16:26:29.042  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +736ms
    01-13 16:26:32.760  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +721ms
    01-13 16:26:36.490  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +722ms
    01-13 16:26:40.223  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +722ms
    01-13 16:26:43.957  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +724ms
    01-13 16:26:47.726  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +718ms
    01-13 16:26:51.476  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +722ms
    01-13 16:26:55.224  1473  1503 I ActivityTaskManager: Displayed com.xamarin.forms.helloforms/crc6450e568c951913723.MainActivity: +724ms
    Average(ms): 723.7
    Std Err(ms): 1.90933379888262
    Std Dev(ms): 6.0378436180109

In this scenario the changes seems to save ~3.7ms to overall startup.
The code for this project is here:

https://github.com/jonathanpeppers/Xamarin.Forms/commit/a319b6709894379b5d08703f80238e5ef5a92ba0

I timed a Release build running on a Pixel 3 XL.

* Fixed the rounding issue when the stepper value is incremented. (#7383)

* Fixed the rounding issue when the stepper value is incremented and the increment value is small like say 0.5 per step. This is due to Double being used as the value so when it's unboxed from the binding object precision is lost.

* Updated so that it's not using Math.Round as this will limit the number of decimal places in code, this version will use an internal counter to track the number of clicks the user makes and calculate a clean value using the counter times the increment.  Tests updated as well to test for stepping away from and back to zero...

* fixed issue with tests failing which was caused by the use of (int) causing a rounding down error...

* Update Xamarin.Forms.Core/Stepper.cs

Co-Authored-By: Gerald Versluis <github@geraldversluis.nl>
* Updated to use nameof() instead of strings in teh creation of the new BindableProperties...

* Changed the Bindable StepperPositionProperty from being public to private so that there is not an API change with this PR as suggested by Sam Houts.Once this PR is accepted it may be an idea to revert this change so that the Positon Property can be controled and used as it's an int saves the need to work with doubles for calculating the position...

Co-authored-by: Samantha Houts <samhouts@users.noreply.github.com>
Co-authored-by: Gerald Versluis <github@geraldversluis.nl>
fixes #5168

* Fixed the build issue

* Avoid NRE removing WeakReferences (and remove null ones) (#9195) fixes #9183

* [CSS] reapply Stylesheet on StyleClass changes (#9157)

- fixes #2678

* [HR] complement the sourceinfo with assemblyname (#9294)
77 files changed:
Xamarin.Forms/Xamarin.Forms.Build.Tasks/ExpandMarkupsVisitor.cs
Xamarin.Forms/Xamarin.Forms.Build.Tasks/TypeReferenceExtensions.cs [changed mode: 0644->0755]
Xamarin.Forms/Xamarin.Forms.Build.Tasks/XamlCTask.cs [changed mode: 0644->0755]
Xamarin.Forms/Xamarin.Forms.Core/ActionSheetArguments.cs
Xamarin.Forms/Xamarin.Forms.Core/Binding.cs
Xamarin.Forms/Xamarin.Forms.Core/BindingBase.cs
Xamarin.Forms/Xamarin.Forms.Core/BindingBaseExtensions.cs
Xamarin.Forms/Xamarin.Forms.Core/BindingExpression.cs
Xamarin.Forms/Xamarin.Forms.Core/Color.cs
Xamarin.Forms/Xamarin.Forms.Core/DependencyService.cs
Xamarin.Forms/Xamarin.Forms.Core/Element_StyleSheets.cs
Xamarin.Forms/Xamarin.Forms.Core/EmbeddedFont.cs [new file with mode: 0644]
Xamarin.Forms/Xamarin.Forms.Core/ExportFontAttribute.cs [new file with mode: 0644]
Xamarin.Forms/Xamarin.Forms.Core/FontFile.cs [new file with mode: 0644]
Xamarin.Forms/Xamarin.Forms.Core/FontRegistrar.cs [new file with mode: 0644]
Xamarin.Forms/Xamarin.Forms.Core/IEmbeddedFontLoader.cs [new file with mode: 0644]
Xamarin.Forms/Xamarin.Forms.Core/IndicatorView.cs
Xamarin.Forms/Xamarin.Forms.Core/Interactivity/AttachedCollection.cs
Xamarin.Forms/Xamarin.Forms.Core/Internals/ToolbarTracker.cs
Xamarin.Forms/Xamarin.Forms.Core/MergedStyle.cs
Xamarin.Forms/Xamarin.Forms.Core/NavigationPage.cs
Xamarin.Forms/Xamarin.Forms.Core/NumericExtensions.cs
Xamarin.Forms/Xamarin.Forms.Core/Page.cs
Xamarin.Forms/Xamarin.Forms.Core/ReflectionExtensions.cs
Xamarin.Forms/Xamarin.Forms.Core/Registrar.cs
Xamarin.Forms/Xamarin.Forms.Core/Shell/IShellContentController.cs
Xamarin.Forms/Xamarin.Forms.Core/Shell/IShellController.cs
Xamarin.Forms/Xamarin.Forms.Core/Shell/IShellItemController.cs
Xamarin.Forms/Xamarin.Forms.Core/Shell/IShellSectionController.cs
Xamarin.Forms/Xamarin.Forms.Core/Shell/NavigableElement.cs
Xamarin.Forms/Xamarin.Forms.Core/Shell/PresentationMode.cs [new file with mode: 0644]
Xamarin.Forms/Xamarin.Forms.Core/Shell/Shell.cs
Xamarin.Forms/Xamarin.Forms.Core/Shell/ShellContent.cs
Xamarin.Forms/Xamarin.Forms.Core/Shell/ShellContentCollection.cs
Xamarin.Forms/Xamarin.Forms.Core/Shell/ShellExtensions.cs
Xamarin.Forms/Xamarin.Forms.Core/Shell/ShellItem.cs
Xamarin.Forms/Xamarin.Forms.Core/Shell/ShellItemCollection.cs
Xamarin.Forms/Xamarin.Forms.Core/Shell/ShellSection.cs
Xamarin.Forms/Xamarin.Forms.Core/Shell/ShellSectionCollection.cs
Xamarin.Forms/Xamarin.Forms.Core/Shell/ShellUriHandler.cs
Xamarin.Forms/Xamarin.Forms.Core/StackLayout.cs
Xamarin.Forms/Xamarin.Forms.Core/Stepper.cs
Xamarin.Forms/Xamarin.Forms.Core/TabIndexExtensions.cs
Xamarin.Forms/Xamarin.Forms.Core/Xaml/Diagnostics/VisualDiagnostics.cs
Xamarin.Forms/Xamarin.Forms.Material.Tizen/Shell/MaterialNavigationView.cs
Xamarin.Forms/Xamarin.Forms.Material.Tizen/Xamarin.Forms.Material.Tizen.csproj
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Deserializer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/EmbeddedFontLoader.cs [new file with mode: 0755]
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Extensions/FontExtensions.cs [new file with mode: 0755]
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Extensions/ImageExtensions.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Forms.cs [changed mode: 0644->0755]
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/LightweightPlatform.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Native/Image.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Platform.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/PopupManager.cs [new file with mode: 0644]
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Properties/AssemblyInfo.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Renderers/DatePickerRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Renderers/ImageRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Renderers/LabelRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Renderers/SearchBarRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Renderers/TimePickerRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Shell/INavigationView.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Shell/NavigationView.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Shell/ShellNavBar.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Shell/ShellRenderer.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/Shell/ShellSectionNavigation.cs
Xamarin.Forms/Xamarin.Forms.Platform.Tizen/StaticRegistrar.cs
Xamarin.Forms/Xamarin.Forms.Xaml/ApplyPropertiesVisitor.cs
Xamarin.Forms/Xamarin.Forms.Xaml/ExpandMarkupsVisitor.cs
Xamarin.Forms/Xamarin.Forms.Xaml/MarkupExpressionParser.cs
Xamarin.Forms/Xamarin.Forms.Xaml/MarkupExtensionParser.cs
Xamarin.Forms/Xamarin.Forms.Xaml/XamlLoader.cs
Xamarin.Forms/Xamarin.Forms.Xaml/XamlParser.cs
Xamarin.Forms/Xamarin.Forms.Xaml/XamlServiceProvider.cs