0

I have a Xamarin Forms project with iOS and Android applications in it. The other day I did several udates to XF and Visual Studio 2019 (running the latest none beta releases). In the middle of this I was also moving a bunch of my shared code, including ContentViews used in multiple projects for my product, into a seperate .Net Core class library. Once I got everything working, I was debugging one of my shared content views in my Android project. I started noticing that changes I was making to the XAML of the ContentView were not being reflected in my XAML on the Android device. Just to double check, I ran the iOS version of the project and everything worked fine.

This is what my solution explorer looks like:

enter image description here

The Kiosk project is the Xamarin Forms App. The UCISharedAll contains the shared ContentView in the UCIFooter folder.

This is the XAML from the Footer

<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms" 
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:sfbtn="clr-namespace:Syncfusion.XForms.Buttons;assembly=Syncfusion.Buttons.XForms"
             xmlns:localapp="clr-namespace:UCISharedAll.Resources;assembly=UCISharedAll"
             mc:Ignorable="d"
             x:Class="UCISharedAll.UCIFtr.UCIFooter">

    <ContentView.Resources>
        <ResourceDictionary>
            <Style x:Key="slBackground" TargetType="StackLayout" >
                <Setter Property="BackgroundColor" Value="{DynamicResource FooterBackgroundColor}" />
                <Setter Property="HorizontalOptions" Value="Fill" />
                <Setter Property="VerticalOptions" Value="End" />
                <Setter Property="Orientation" Value="Vertical" />
                <Setter Property="Margin" Value="0,0,0,0" />
            </Style>

            <Style x:Key="ftrLblStyle" TargetType="Label">
                <Setter Property="TextColor" Value="{DynamicResource FooterTextColor}" />
                <Setter Property="VerticalOptions" Value="Center" />
                <Setter Property="HorizontalOptions" Value="Center" />
                <Setter Property="HorizontalTextAlignment" Value="Center" />
                <Setter Property="FontSize" Value="Micro" />
            </Style>

            <Style x:Key="ftrLinkStyle" TargetType="Label">
                <Setter Property="TextColor" Value="{DynamicResource FooterTextColor}" />
                <Setter Property="VerticalOptions" Value="Center" />
                <Setter Property="HorizontalOptions" Value="Center" />
                <Setter Property="HorizontalTextAlignment" Value="Center" />
                <Setter Property="FontSize" Value="Micro" />
                <Setter Property="TextDecorations" Value="Underline" />
                <Setter Property="FontAttributes" Value="Bold" />
            </Style>


            <Style x:Key="PrivacyButtonStlye" TargetType="sfbtn:SfButton">
                <Setter Property="BorderColor" Value="#4D648D"/>
                <Setter Property="IsCheckable" Value="False" />                 
                <Setter Property="FontSize" Value="Micro" />
                <Setter Property="CornerRadius" Value="10"/>
                <Setter Property="ImageAlignment" Value="Start" />
                <Setter Property="BackgroundColor" Value="{DynamicResource PrivacyBtnBackgroundColor}" />
                <Setter Property="TextColor" Value="{DynamicResource PrivacyBtnTextColor}" />
                <Setter Property="HorizontalTextAlignment" Value="Center" />
                <Setter Property="ShowIcon" Value="true"/>
                <Setter Property="FontAttributes" Value="Bold" />
                <Setter Property="HorizontalOptions" Value="Center" />
                <Setter Property="VerticalOptions" Value="Start" />
                <Setter Property="ImageSource" Value="lock.png" />
                <Setter Property="Padding" Value="8" />
            </Style>

        </ResourceDictionary>
    </ContentView.Resources>

    <ContentView.Content>
        <StackLayout x:Name="slMaster" Style="{DynamicResource slBackground}" >
            <StackLayout x:Name="slUserFooterArea" Orientation="Vertical" IsVisible="{Binding ShowFooterText}" 
                         HorizontalOptions="Fill" VerticalOptions="Start" Margin="0,4,0,4">
                <Label x:Name="lblUserFooterText" Text="{Binding KioskFooterText}" Style="{DynamicResource ftrLblStyle}" />
                <BoxView BackgroundColor="{DynamicResource DividerLineColor}" HeightRequest="2" HorizontalOptions="Fill" />
            </StackLayout>

            <!--This has to be in a stack layout so it does not go all the way across the screen-->
            <StackLayout Orientation="Horizontal" HorizontalOptions="Center" VerticalOptions="Start" Margin="0,8,0,0">
                <sfbtn:SfButton x:Name="btnPrivacy" Text="{localapp:Translate Privacy}" Clicked="btnPrivacyStatement_Clicked"
                                Style="{DynamicResource PrivacyButtonStlye}" />
            </StackLayout>
            <StackLayout Orientation="Horizontal" Margin="0,8,0,0" HorizontalOptions="Center">
                <Label x:Name="lblAppFooterText" Style="{DynamicResource ftrLblStyle}" />
                <sfbtn:SfButton x:Name="btnPSSName" Clicked="btnPSSName_Clicked" HeightRequest="32">
                    <Label x:Name="lblPSSName" Text="{localapp:Translate PSSName}" Style="{DynamicResource ftrLinkStyle}"/>
                </sfbtn:SfButton>
            </StackLayout>
        </StackLayout>
    </ContentView.Content>
</ContentView>

To test I have been adding a background color on the lblPSSName. In the iOS project everything is fine. In the Android project, the UI is not updated. I am running the Android app on a Physical Device (a Digiland Tablet).

The only way I seem to be able to get the app to update on the Android tablet is to delete the app and change the configuration back and forth between Debug and Release (i.e. if it was debug on the last run, change it to release etc.)

The results of my Testing testing is as follows: ((I un-install the app between each test) On Emulator in Release Mode - Changes are visible

On Emulator in Debug Mode - Changes are not visible

On Digiland Tablet in Debug Mode - Changes are not visible On Digiland Tablet in Release Mode - Changes are not visible On Android Tablet emulator in Debug Mode - Changes are not visible

On Android Tablet emulator in Release Mode - Changes are not visible

I have tried the recommendations in all these article and they made no difference:

User Interface Not Reflecting Changes i make

https://forums.xamarin.com/discussion/45327/newest-version-of-code-not-always-deployed-when-debugging-from-xamarin-studio

Xamarin.Forms Android VS2017 debug not showing XAML changes

I also tried changing some android options as seen below enter image description here

I turned off Enable Accelerated Rendering and enabled Refresh layout preview on code changes.

If anyone has some ideas as to how to resolve this I would grealty appreciate it. To be clear I was having the happen a while ago - then it went away. Several updates later - it appears to be back but only for Android this time. Below is everything from my VS About page.

Microsoft Visual Studio Professional 2019 Version 16.5.2 VisualStudio.16.Release/16.5.2+29926.136 Microsoft .NET Framework Version 4.8.03752

Installed Version: Professional

Visual C++ 2019 00435-20050-31374-AA182 Microsoft Visual C++ 2019

ADL Tools Service Provider 1.0 This package contains services used by Data Lake tools

ASA Service Provider 1.0

ASP.NET and Web Tools 2019 16.5.236.49856 ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019 16.5.236.49856 For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 16.5.236.49856 Azure App Service Tools v3.0.0

Azure Data Lake Node 1.0 This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.4.5000.0 Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 16.5.236.49856 Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.4.5000.0 Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 3.5.0-beta4-20153-05+20b9af913f1b8ce0a62f72bea9e75e4aa3cf6b0e C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.2.0 (d16-2@8b56e20) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents 1.0 Fabric Diagnostic Events

IntelliCode Extension 1.0 IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure HDInsight Azure Node 2.4.5000.0 HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service 2.4.5000.0 Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio 16.0 Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service 2.4.5000.0 Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node 1.0 Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools 2.9 Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30207.1

Microsoft Continuous Delivery Tools for Visual Studio 0.4 Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 2.1.25+gdacdb9b7a1 Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0 Microsoft Visual C++ Wizards

Microsoft Visual Studio Process Editor 1.0 Process Editor for Microsoft Visual Studio Team Foundation Server

Microsoft Visual Studio Tools for Containers 1.1 Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package 1.0 Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 16.5.514 (c4f36a9) Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 5.5.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info

SQL Server Data Tools 16.0.62003.05170 Microsoft SQL Server Data Tools

ToolWindowHostedEditor 1.0 Hosting json editor into a tool window

TypeScript Tools 16.0.20225.2001 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.5.0-beta4-20153-05+20b9af913f1b8ce0a62f72bea9e75e4aa3cf6b0e Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual C++ for Cross Platform Mobile Development (Android) 16.0.29814.53 Visual C++ for Cross Platform Mobile Development (Android)

Visual F# Tools 10.8.0.0 for F# 4.7 16.5.0-beta.20104.8+7c4de19faf36647c1ef700e655a52350840c6f03 Microsoft Visual F# Tools 10.8.0.0 for F# 4.7

Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions (Preview) 1.0 View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers 1.0 Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes 1.0 Visual Studio Tools for Kubernetes

VisualStudio.DeviceLog 1.0 Information about my package

VisualStudio.Foo 1.0 Information about my package

VisualStudio.Mac 1.0 Mac Extension for Visual Studio

Xamarin 16.5.000.528 (d16-5@2b54082) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.5.0.470 (remotes/origin/d16-5@681de3fd6) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.5.49 (0904f41) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 10.2.0.100 (d16-5/988c811) Xamarin.Android Reference Assemblies and MSBuild support. Mono: c0c5c78 Java.Interop: xamarin/java.interop/d16-5@fc18c54 ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.28.0@46204c4 Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-5@9f4ed4b

Xamarin.iOS and Xamarin.Mac SDK 13.16.0.11 (aa73e41) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

George M Ceaser Jr
  • 1,497
  • 3
  • 23
  • 52

1 Answers1

0

Actually I think I figured out what the problem was... Here is the scenario

I had created two themes - light and dark and had originally replicated styles definitions in each theme class. SO -- I added the use of the styles to my XAML using the {DynamicResource MyStyle}.

The problem there was whenever I wanted to change the style I had to change it in two places. SO - I moved the styles into the specific pages where they were used. (Luckily there were pretty specific to individual pages.) HOWEVER, when I did that I never changed the DynamicResource entries to StaticResource entries. I am not sure why the styles ever worked that way but they kind of did and I didn't receive any error messages. Regardless, I changed them all to StaticResources now and the problem seems to have calmed down.

I won't mark this the answer until I test more but so far so good.

George M Ceaser Jr
  • 1,497
  • 3
  • 23
  • 52