Skip to content

Commit 180f655

Browse files
committed
Add more crash test options
1 parent 25a6eea commit 180f655

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

Telegram/Views/DiagnosticsPage.xaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,12 @@
175175
</controls:HeaderedControl>
176176

177177
<controls:HeaderedControl>
178-
<controls:SettingsButton Content="Bridge debug"
179-
Click="Bridge_Click" />
178+
<controls:SettingsButton Content="Generate exception"
179+
Click="Exception_Click" />
180180
<controls:SettingsButton Content="Crash the app &#x2620;"
181181
Click="Crash_Click" />
182+
<controls:SettingsButton Content="Crash TDLib &#x2620;"
183+
Click="Logger_Click" />
182184
</controls:HeaderedControl>
183185
</controls:SettingsPanel>
184186
</ScrollViewer>

Telegram/Views/DiagnosticsPage.xaml.cs

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
using Telegram.Common;
99
using Telegram.Converters;
1010
using Telegram.Native;
11+
using Telegram.Td;
12+
using Telegram.Td.Api;
1113
using Telegram.ViewModels;
1214
using Windows.UI.Xaml;
1315
using Windows.UI.Xaml.Hosting;
@@ -38,31 +40,19 @@ private string ConvertSize(ulong size)
3840

3941
#endregion
4042

41-
private void Crash_Click(object sender, RoutedEventArgs e)
43+
private void Exception_Click(object sender, RoutedEventArgs e)
4244
{
43-
NativeUtils.Crash();
44-
return;
45-
4645
ElementCompositionPreview.GetElementVisual(null);
47-
return;
48-
49-
if (sender is FrameworkElement element)
50-
{
51-
element.SizeChanged += (s, args) =>
52-
{
53-
element.Height++;
54-
};
55-
56-
element.Height = element.ActualHeight + 1;
57-
}
5846
}
5947

60-
private void Bridge_Click(object sender, RoutedEventArgs e)
48+
private void Crash_Click(object sender, RoutedEventArgs e)
6149
{
62-
ElementCompositionPreview.GetElementVisual(null);
63-
return;
50+
NativeUtils.Crash();
51+
}
6452

65-
NotifyIcon.Debug("Message received");
53+
private void Logger_Click(object sender, RoutedEventArgs e)
54+
{
55+
Client.Execute(new AddLogMessage(0, "This should produce a stack trace"));
6656
}
6757
}
6858
}

0 commit comments

Comments
 (0)