Skip to content

Commit f1dd5af

Browse files
committed
Implement Error Reporting
1 parent a4f8e16 commit f1dd5af

File tree

6 files changed

+130
-9
lines changed

6 files changed

+130
-9
lines changed

Files UWP/App.xaml.cs

+9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public App()
2121
{
2222
this.InitializeComponent();
2323
this.Suspending += OnSuspending;
24+
this.UnhandledException += App_UnhandledException;
25+
2426
Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
2527

2628
if (localSettings.Values["theme"] != null)
@@ -64,6 +66,13 @@ public App()
6466

6567
}
6668

69+
private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
70+
{
71+
e.Handled = true;
72+
Frame rootFrame = Window.Current.Content as Frame;
73+
rootFrame.Navigate(typeof(UnhandledExceptionDisplay), e.Exception);
74+
}
75+
6776
public static PasteState PS { get; set; } = new PasteState();
6877

6978
/// <summary>

Files UWP/FilesUWP.csproj

+7
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@
152152
<Compile Include="SettingsPages\Preferences.xaml.cs">
153153
<DependentUpon>Preferences.xaml</DependentUpon>
154154
</Compile>
155+
<Compile Include="UnhandledExceptionDisplay.xaml.cs">
156+
<DependentUpon>UnhandledExceptionDisplay.xaml</DependentUpon>
157+
</Compile>
155158
<Compile Include="YourHome.xaml.cs">
156159
<DependentUpon>YourHome.xaml</DependentUpon>
157160
</Compile>
@@ -218,6 +221,10 @@
218221
<SubType>Designer</SubType>
219222
<Generator>MSBuild:Compile</Generator>
220223
</Page>
224+
<Page Include="UnhandledExceptionDisplay.xaml">
225+
<SubType>Designer</SubType>
226+
<Generator>MSBuild:Compile</Generator>
227+
</Page>
221228
<Page Include="YourHome.xaml">
222229
<SubType>Designer</SubType>
223230
<Generator>MSBuild:Compile</Generator>
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<Page
2+
x:Class="Files.UnhandledExceptionDisplay"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:Files"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
mc:Ignorable="d"
9+
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
10+
<ScrollViewer>
11+
<Grid Padding="48">
12+
<Grid.ColumnDefinitions>
13+
<ColumnDefinition Width="90*"/>
14+
<ColumnDefinition Width="10*"/>
15+
</Grid.ColumnDefinitions>
16+
<StackPanel Spacing="24" Orientation="Vertical" Margin="48,48,48,48">
17+
<StackPanel Spacing="24" Orientation="Horizontal">
18+
<FontIcon FontSize="48" Glyph="&#xE783;"/>
19+
<TextBlock FontSize="32" FontWeight="Bold" Text="We didn't expect that"/>
20+
</StackPanel>
21+
<TextBlock TextWrapping="WrapWholeWords" FontSize="24" Text="Files ran into a problem that the developers didn't prepare for yet. Please restart the app and try what you were doing again."/>
22+
<StackPanel Spacing="5" Orientation="Vertical">
23+
<TextBlock FontSize="24" Text="Summary:" FontWeight="SemiBold"/>
24+
<TextBlock IsTextSelectionEnabled="True" Padding="24,0,0,0" TextWrapping="Wrap" FontSize="18" Name="Summary"/>
25+
<TextBlock FontSize="24" Text="Technical Information:" FontWeight="SemiBold"/>
26+
<TextBlock IsTextSelectionEnabled="True" Padding="24,0,0,0" TextWrapping="Wrap" FontSize="18" Name="ErrorInfo"/>
27+
<TextBlock FontSize="24" Text="What now?" FontWeight="SemiBold"/>
28+
<StackPanel Spacing="24" Orientation="Horizontal">
29+
<Button Width="200" Content="Close App to Try Again" HorizontalAlignment="Left" Click="Button_Click"/>
30+
<Button Width="200" Content="Report Issue to Developer" Click="Button_Click_1"/>
31+
</StackPanel>
32+
</StackPanel>
33+
34+
</StackPanel>
35+
</Grid>
36+
</ScrollViewer>
37+
</Page>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Runtime.InteropServices.WindowsRuntime;
6+
using Windows.ApplicationModel.Core;
7+
using Windows.Foundation;
8+
using Windows.Foundation.Collections;
9+
using Windows.System;
10+
using Windows.UI.Xaml;
11+
using Windows.UI.Xaml.Controls;
12+
using Windows.UI.Xaml.Controls.Primitives;
13+
using Windows.UI.Xaml.Data;
14+
using Windows.UI.Xaml.Input;
15+
using Windows.UI.Xaml.Media;
16+
using Windows.UI.Xaml.Navigation;
17+
18+
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
19+
20+
namespace Files
21+
{
22+
/// <summary>
23+
/// An empty page that can be used on its own or navigated to within a Frame.
24+
/// </summary>
25+
public sealed partial class UnhandledExceptionDisplay : Page
26+
{
27+
public UnhandledExceptionDisplay()
28+
{
29+
this.InitializeComponent();
30+
var CoreTitleBar = CoreApplication.GetCurrentView().TitleBar;
31+
CoreTitleBar.ExtendViewIntoTitleBar = false;
32+
}
33+
34+
protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
35+
{
36+
base.OnNavigatedTo(eventArgs);
37+
var Parameter = eventArgs.Parameter as Exception;
38+
Summary.Text = Parameter.Message;
39+
ErrorInfo.Text = Parameter.StackTrace;
40+
}
41+
42+
// Close App
43+
private void Button_Click(object sender, RoutedEventArgs e)
44+
{
45+
CoreApplication.Exit();
46+
}
47+
48+
// Report issue
49+
private async void Button_Click_1(object sender, RoutedEventArgs e)
50+
{
51+
await Launcher.LaunchUriAsync(new Uri(@"https://github.com/duke7553/files-uwp/issues/new"));
52+
}
53+
}
54+
}

Files.sln

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "FilesUwp.Package", "FilesUw
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FilesUWP", "Files UWP\FilesUWP.csproj", "{64C30C4E-A69A-411C-9F78-776E7AAD583C}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExecutableLauncher", "ExecutableLauncher\ExecutableLauncher.csproj", "{4A643C29-0E4C-4CEE-941D-6485280B5F0A}"
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExecutableLauncher", "ExecutableLauncher\ExecutableLauncher.csproj", "{4A643C29-0E4C-4CEE-941D-6485280B5F0A}"
1111
EndProject
1212
Global
1313
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -24,9 +24,9 @@ Global
2424
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Debug|ARM.ActiveCfg = Debug|ARM
2525
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Debug|ARM.Build.0 = Debug|ARM
2626
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Debug|ARM.Deploy.0 = Debug|ARM
27-
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Debug|ARM64.ActiveCfg = Debug|x86
28-
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Debug|ARM64.Build.0 = Debug|x86
29-
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Debug|ARM64.Deploy.0 = Debug|x86
27+
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Debug|ARM64.ActiveCfg = Debug|ARM64
28+
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Debug|ARM64.Build.0 = Debug|ARM64
29+
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Debug|ARM64.Deploy.0 = Debug|ARM64
3030
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Debug|x64.ActiveCfg = Debug|x64
3131
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Debug|x64.Build.0 = Debug|x64
3232
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Debug|x64.Deploy.0 = Debug|x64
@@ -36,9 +36,9 @@ Global
3636
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Release|ARM.ActiveCfg = Release|ARM
3737
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Release|ARM.Build.0 = Release|ARM
3838
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Release|ARM.Deploy.0 = Release|ARM
39-
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Release|ARM64.ActiveCfg = Release|x86
40-
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Release|ARM64.Build.0 = Release|x86
41-
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Release|ARM64.Deploy.0 = Release|x86
39+
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Release|ARM64.ActiveCfg = Release|ARM64
40+
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Release|ARM64.Build.0 = Release|ARM64
41+
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Release|ARM64.Deploy.0 = Release|ARM64
4242
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Release|x64.ActiveCfg = Release|x64
4343
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Release|x64.Build.0 = Release|x64
4444
{3B15596C-3DB9-4B58-B4C8-442D06A8C130}.Release|x64.Deploy.0 = Release|x64

FilesUwp.Package/FilesUwp.Package.wapproj

+16-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@
2828
<Configuration>Release</Configuration>
2929
<Platform>ARM</Platform>
3030
</ProjectConfiguration>
31+
<ProjectConfiguration Include="Debug|ARM64">
32+
<Configuration>Debug</Configuration>
33+
<Platform>ARM64</Platform>
34+
</ProjectConfiguration>
35+
<ProjectConfiguration Include="Release|ARM64">
36+
<Configuration>Release</Configuration>
37+
<Platform>ARM64</Platform>
38+
</ProjectConfiguration>
3139
</ItemGroup>
3240
<PropertyGroup>
3341
<WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
@@ -45,7 +53,7 @@
4553
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
4654
<AppInstallerUpdateFrequency>1</AppInstallerUpdateFrequency>
4755
<AppInstallerCheckForUpdateFrequency>OnApplicationRun</AppInstallerCheckForUpdateFrequency>
48-
<AppxPackageDir>C:\Users\Luke\Documents\</AppxPackageDir>
56+
<AppxPackageDir>C:\builds\</AppxPackageDir>
4957
</PropertyGroup>
5058
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
5159
<AppxBundle>Never</AppxBundle>
@@ -62,6 +70,12 @@
6270
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
6371
<AppxBundle>Never</AppxBundle>
6472
</PropertyGroup>
73+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
74+
<AppxBundle>Never</AppxBundle>
75+
</PropertyGroup>
76+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
77+
<AppxBundle>Never</AppxBundle>
78+
</PropertyGroup>
6579
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
6680
<AppxBundle>Never</AppxBundle>
6781
</PropertyGroup>
@@ -72,7 +86,7 @@
7286
</ItemGroup>
7387
<ItemGroup>
7488
<ProjectReference Include="..\ExecutableLauncher\ExecutableLauncher.csproj">
75-
<DesktopBridgeSelfContained>True</DesktopBridgeSelfContained>
89+
<DesktopBridgeSelfContained>False</DesktopBridgeSelfContained>
7690
<DesktopBridgeIdentifier>$(DesktopBridgeRuntimeIdentifier)</DesktopBridgeIdentifier>
7791
<Properties>SelfContained=%(DesktopBridgeSelfContained);RuntimeIdentifier=%(DesktopBridgeIdentifier)</Properties>
7892
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>

0 commit comments

Comments
 (0)