Bug 41919 - SearchBar crash because set FontFamily in UWP global FontFamily style
Summary: SearchBar crash because set FontFamily in UWP global FontFamily style
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows (show other bugs)
Version: 2.2.0
Hardware: PC Windows
: --- normal
Target Milestone: UWP
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-06-17 04:50 UTC by Mike
Modified: 2017-07-12 09:43 UTC (History)
5 users (show)

See Also:
Tags: Windows ac
Is this bug a regression?: ---
Last known good build:


Attachments
Sample (102.54 KB, application/x-rar)
2016-06-17 04:50 UTC, Mike
Details
Search Logs (1.43 KB, application/x-zip-compressed)
2017-07-12 09:43 UTC, Jacky Waswani
Details

Description Mike 2016-06-17 04:50:56 UTC
Created attachment 16374 [details]
Sample

I add a style in my UWP application global resources:


<Application
    x:Class="App1.UWP.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App1.UWP"
    RequestedTheme="Light">

    <Application.Resources>
        <ResourceDictionary>
            <Style TargetType="AutoSuggestBox">
                <Setter Property="FontFamily" Value="/Assets/fontName.ttf#fontName"/>
            </Style>
        </ResourceDictionary>
    </Application.Resources>
</Application>



But that will let the Xamarin.Form crash when use <SearchBar   /> in xaml of Xamarin.


I upload a sample file.
Comment 1 E.Z. Hart [MSFT] 2016-07-11 21:41:41 UTC
Still happens in 2.3.0.107.
Comment 2 Mike 2016-07-12 03:21:53 UTC
I found it will also crash if I input some arabic character in it.(Right to left)
Comment 3 Paul DiPietro [MSFT] 2017-02-16 22:53:30 UTC
Normally what you would want to do here in order to apply the style is something like this:

<Style TargetType="AutoSuggestBox">
    <Setter Property="TextBoxStyle" Value="{StaticResource CustomTextBoxStyle}"/>
</Style>
            
<Style TargetType="TextBox" x:Key="CustomTextBoxStyle">
    <Setter Property="FontFamily" Value="Comic Sans MS"></Setter>
</Style>

However, using your original style in a regular UWP app doesn't cause a crash, and appears to be due to a naming conflict on the TextBox style used for AutoSuggestBox in Forms, so it's probably worth adjusting to prevent possible crashes.
Comment 4 Rui Marinho 2017-03-07 10:04:16 UTC
Should be fixed in 2.3.5-pre1
Comment 5 Jacky Waswani 2017-07-12 09:43:17 UTC
Have verified the bug with latest forms build version 2.3.5.256-pre6.

Bug is seems to be fixed.

Attaching the screencast & logs for more detail.

Screencast : https://www.screencast.com/t/8g1jhlyd

Build Info:https://gist.github.com/GLjackyvaswani/600433ce6f3b92544b42d0392001d326
Comment 6 Jacky Waswani 2017-07-12 09:43:37 UTC
Created attachment 23489 [details]
Search Logs

Notice (2018-05-21): bugzilla.xamarin.com will be switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.

Please join us on Visual Studio Developer Community and GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs and copy them to the new locations as needed for follow-up. The See Also field on each Bugzilla bug will be updated with a link to its new location when applicable.

After Bugzilla is read-only, if you have new information to add for a bug that does not yet have a matching issue on Developer Community or GitHub, you can create a follow-up issue in the new location. Copy and paste the title and description from this bug, and then add your new details. You can get a pre-formatted version of the title and description here:

In special cases you might also want the comments:

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Note You need to log in before you can comment on or make changes to this bug.