Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UWP App crashes on startup

we have developed a UWP app which works fine on most of the devices. However, a customer has managed devices with Windows 10 1511 and the app crashes immediately after start. We are not able to attach a VS debugger to it so we used windbg to launch and break the application. From what I can see, the output of windbg below is where the application crashes.

The App Launch Event is stripped down to nearly empty, so there is no code running after startup but still the app crashes.

Any idea how to track this further?

thanks

ModLoad: 00007ffe`ec020000 00007ffe`ec27f000   C:\Windows\SYSTEM32\dwrite.dll
ModLoad: 00007ffe`cfef0000 00007ffe`d0075000   C:\Windows\System32\Windows.Globalization.dll
(241c.2278): Windows Runtime Originate Error - code 40080201 (first chance)
(241c.2278): Windows Runtime Originate Error - code 40080201 (first chance)
windows\dxaml\xcp\components\deferral\customwriterruntimeobjectcreator.cpp(222)\Windows.UI.Xaml.dll!00007FFED0E99DA7: (caller: 00007FFED0B7A503) Exception(1) tid(2278) 80004005 Unspecified error
(241c.2278): C++ EH exception - code e06d7363 (first chance)
(241c.2278): C++ EH exception - code e06d7363 (first chance)
windows\dxaml\xcp\core\core\elements\style.cpp(582)\Windows.UI.Xaml.dll!00007FFED0D851D9: (caller: 00007FFED0BFB365) ReturnHr(1) tid(2278) 80004005 Unspecified error
windows\dxaml\xcp\components\deferral\customwriterruntimeobjectcreator.cpp(113)\Windows.UI.Xaml.dll!00007FFED0DEEE15: (caller: 00007FFED0B0B954) Exception(2) tid(2278) 80004005 Unspecified error
(241c.2278): C++ EH exception - code e06d7363 (first chance)
(241c.2278): C++ EH exception - code e06d7363 (first chance)
windows\dxaml\xcp\components\resources\resourcedictionary2.cpp(48)\Windows.UI.Xaml.dll!00007FFED0D67F6D: (caller: 00007FFED0B67966) ReturnHr(2) tid(2278) 80004005 Unspecified error
(241c.2278): Windows Runtime Originate Error - code 40080201 (first chance)
(241c.2278): CLR exception - code e0434352 (first chance)
(241c.2278): Windows Runtime Originate Error - code 40080201 (first chance)
ModLoad: 00007ffe`ea590000 00007ffe`ea5f8000   C:\Windows\System32\mscoree.dll
ModLoad: 00007ffe`e9630000 00007ffe`e96cd000   C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscoreei.dll
ModLoad: 00007ffe`ea590000 00007ffe`ea5f8000   C:\Windows\System32\mscoree.dll
ModLoad: 00007ffe`e9630000 00007ffe`e96cd000   C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscoreei.dll
(241c.2278): CLR exception - code e0434352 (first chance)
(241c.2278): CLR exception - code e0434352 (first chance)
(241c.2278): Windows Runtime Originate Error - code 40080201 (first chance)
(241c.2278): Windows Runtime Originate Error - code 40080201 (first chance)
ntdll!NtWaitForMultipleObjects+0x14:
00007ffe`f7b25c24 c3              ret
0:000> g
       ^ No runnable debuggees error in 'g'

Update 1

I did further testing and it came out, that when i remove the reference of a shared dictionary with some xaml styles in it, the app works, even on 1511. I checked all the references and played around but none of it makes it work on 1511. I could truly not see what was introduced in 1607 what was not already there with 1511. Again, all works well on 1607 & 1703 builds. Here is the code:

Project 1 (Main UWP App)

App.xaml

<Application
x:Class="XXXXXXXXXXXXXXXXXXXXXX"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="XXXXXXXXXXXXXXXXXXXX"
RequestedTheme="Light">
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="ms-appx:///SDX.Library/SdxStyles.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

Project 2 (Empty UWP Project, with only Styles & Assets) SDX.Library.dll

Styles.xaml

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="SdxColors.xaml" />
    <ResourceDictionary Source="SdxControls.xaml" />
</ResourceDictionary.MergedDictionaries>

SdxColors.xaml

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<SolidColorBrush x:Key="DarkGrey" Color="#FF333333"/>
<SolidColorBrush x:Key="DarkGrey40p" Color="#FFADADAD"/>
<SolidColorBrush x:Key="DarkGrey80p" Color="#5C5C5C"/>
<SolidColorBrush x:Key="InteractionBlue" Color="#FF1781E3"/>
<SolidColorBrush x:Key="BlueRollover" Color="#FF0851DA"/>

<SolidColorBrush x:Key="Successfull" Color="#FF25B252" />
<SolidColorBrush x:Key="Warning" Color="#FFFF8B2E" />
<SolidColorBrush x:Key="Peppermint" Color="#FF0EABA9" />

SdxControls.xaml

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">

<FontFamily x:Key="TheSansB4SemiLight">Assets/Fonts/TheSansB_400_.ttf#TheSans B4 SemiLight</FontFamily>
<FontFamily x:Key="TheSansB5Plain">Assets/Fonts/TheSansB_500_.ttf#TheSans B5 Plain</FontFamily>

<Style TargetType="Button">
    <Setter Property="Background" Value="{ThemeResource InteractionBlue}"/>
    <Setter Property="Foreground" Value="{ThemeResource ButtonForeground}"/>
    <Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}"/>
    <Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}"/>
    <Setter Property="Padding" Value="32,8,32,8"/>
    <Setter Property="HorizontalAlignment" Value="Left"/>
    <Setter Property="VerticalAlignment" Value="Center"/>
    <Setter Property="FontFamily" Value="{StaticResource TheSansB4SemiLight}"/>
    <Setter Property="FontWeight" Value="Normal"/>
    <Setter Property="FontSize" Value="18"/>
    <Setter Property="UseSystemFocusVisuals" Value="False"/>
    <Setter Property="FocusVisualMargin" Value="-3"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                <Grid x:Name="RootGrid" Background="{TemplateBinding Background}" CornerRadius="5" RenderTransformOrigin="0.5,0.5">
                    <Grid.RenderTransform>
                        <CompositeTransform/>
                    </Grid.RenderTransform>
                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="CommonStates">
                            <VisualState x:Name="Normal">
                                <VisualState.Setters>
                                    <Setter Target="RootGrid.(Panel.Background)" Value="{StaticResource InteractionBlue}"/>
                                </VisualState.Setters>
                                <Storyboard>
                                    <PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="PointerOver">
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BlueRollover}"/>
                                    </ObjectAnimationUsingKeyFrames>
                                    <PointerUpThemeAnimation Storyboard.TargetName="RootGrid"/>
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="Pressed">
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BlueRollover}"/>
                                    </ObjectAnimationUsingKeyFrames>
                                    <PointerDownThemeAnimation Storyboard.TargetName="RootGrid"/>
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="Disabled">
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="RootGrid">
                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource InteractionBlue}"/>
                                    </ObjectAnimationUsingKeyFrames>
                                    <DoubleAnimation Duration="0" To="0.4" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="RootGrid" d:IsOptimized="True"/>
                                    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ContentPresenter" d:IsOptimized="True"/>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <ContentPresenter x:Name="ContentPresenter" AutomationProperties.AccessibilityView="Raw" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTransitions="{TemplateBinding ContentTransitions}" Content="{TemplateBinding Content}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Foreground="White"/>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

like image 665
Sebastian Zolg Avatar asked Apr 21 '17 10:04

Sebastian Zolg


People also ask

Is Microsoft killing UWP?

Microsoft continues to baby-step around the obvious, but it has officially deprecated the Universal Windows Platform (UWP) as it pushes the desktop-focused Windows App SDK (formerly called Project Reunion) and WinUI 3 as the future of Windows application development.

How do I fix UWP app not opening?

Please run Windows Store Apps troubleshooter from Settings app > Update & security > Troubleshoot. See if it helps you. Hope this helps!

Does Windows 11 support UWP?

UWP is one choice for creating apps that run on Windows 10 and Windows 11 devices, and can be combined with other platforms. UWP apps can make use of Win32 APIs and .

What is replacing UWP?

WPF Team Blog. 14 January 2022. As you already know, WinUI is Microsoft's follow-up to UWP. As the successor to the UWP platform, Microsoft has invested heavily in the WinUI platform.

Why does my UWP app keep crashing?

Our UWP app contains many web views and also it loads image/videos etc.. When using the app to load lot of data continuously the app crashes. In different machines this seems to happen at different memory levels. In my machine when the app uses more than 600mb roughly it seems to crash. But the total memory of the machine is at 50%. 1.

Is it possible to debug UWP app on Windows 10 1511?

we have developed a UWP app which works fine on most of the devices. However, a customer has managed devices with Windows 10 1511 and the app crashes immediately after start. We are not able to attach a VS debugger to it so we used windbg to launch and break the application.

Can an application crash on first chance exception?

An application doesn't crash on a first-chance exception, so the log you posted may or may not be related. You'll have to look out for second-chance exceptions (those are the ones, that haven't been caught, and are about to shut down a process).


Video Answer


1 Answers

Sounds like you're re-templating the Button control using a newer version of the SDK. It probably has references to resources that don't exist on 10586. You'll need to redo the re-templating using an older version. The easiest way is to copy/paste the Style from generic.xaml, which you can find here:

C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP

If you have the 10586 SDK installed, you should see a "10.0.10586.0" folder. In there, you'll find \Generic\generic.xaml. Open that file, and find the base Button style. Copy/paste the entire style into your SDXControls.xaml, replacing the Style that's there now.

This is the backward compatible version of the template. If all goes well, your app should no longer crash on 10586.

From there, you can tweak the template to match your design needs.

Tip: You can also add an "x:Key" property to your Style, then reference the Style explicitly on your Buttons as a StaticResource.

like image 116
stenobot Avatar answered Sep 29 '22 18:09

stenobot