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)

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


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

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.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

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