Skip to content

Commit db08ed2

Browse files
committed
import winui-app for testing purposes
1 parent f666304 commit db08ed2

File tree

11 files changed

+228
-0
lines changed

11 files changed

+228
-0
lines changed

integration-test/net8-winui/App.xaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Application
3+
x:Class="winui_app.App"
4+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
6+
xmlns:local="using:winui_app">
7+
<Application.Resources>
8+
<ResourceDictionary>
9+
<ResourceDictionary.MergedDictionaries>
10+
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
11+
<!-- Other merged dictionaries here -->
12+
</ResourceDictionary.MergedDictionaries>
13+
<!-- Other app resources here -->
14+
<ResourceDictionary.ThemeDictionaries>
15+
<ResourceDictionary x:Key="Light">
16+
<BitmapImage x:Key="SentryLogo" UriSource="Assets/sentry-wordmark-dark-300x90.png"/>
17+
</ResourceDictionary>
18+
<ResourceDictionary x:Key="Dark">
19+
<BitmapImage x:Key="SentryLogo" UriSource="Assets/sentry-wordmark-light-300x90.png"/>
20+
</ResourceDictionary>
21+
</ResourceDictionary.ThemeDictionaries>
22+
</ResourceDictionary>
23+
</Application.Resources>
24+
</Application>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using Microsoft.UI.Xaml;
2+
using Sentry.Protocol;
3+
using System.Security;
4+
5+
namespace winui_app
6+
{
7+
public partial class App : Application
8+
{
9+
private Window? _window;
10+
11+
public App()
12+
{
13+
SentrySdk.Init(options =>
14+
{
15+
options.Dsn = "http://key@127.0.0.1:9999/123";
16+
options.Debug = true;
17+
options.IsGlobalModeEnabled = true;
18+
});
19+
UnhandledException += OnUnhandledException;
20+
21+
InitializeComponent();
22+
}
23+
24+
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
25+
{
26+
_window = new MainWindow();
27+
_window.Activate();
28+
}
29+
30+
[SecurityCritical]
31+
private void OnUnhandledException(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e)
32+
{
33+
var exception = e.Exception;
34+
if (exception != null)
35+
{
36+
exception.Data[Mechanism.HandledKey] = false;
37+
exception.Data[Mechanism.MechanismKey] = "Application.UnhandledException";
38+
SentrySdk.CaptureException(exception);
39+
SentrySdk.FlushAsync(TimeSpan.FromSeconds(2)).GetAwaiter().GetResult();
40+
}
41+
}
42+
}
43+
}
Loading
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Window
3+
x:Class="winui_app.MainWindow"
4+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
6+
xmlns:local="using:winui_app"
7+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
mc:Ignorable="d"
10+
Title="winui-app">
11+
12+
<Window.SystemBackdrop>
13+
<MicaBackdrop />
14+
</Window.SystemBackdrop>
15+
16+
<StackPanel
17+
HorizontalAlignment="Center"
18+
VerticalAlignment="Center"
19+
Spacing="24">
20+
21+
<Image Source="{StaticResource SentryLogo}"
22+
HorizontalAlignment="Center"
23+
Stretch="None"/>
24+
25+
<StackPanel Orientation="Horizontal"
26+
HorizontalAlignment="Center"
27+
Spacing="24">
28+
<Button Content="Crash (Managed)"
29+
Click="OnManagedCrashClick"/>
30+
<Button Content="Crash (Native)"
31+
Click="OnNativeCrashClick"/>
32+
</StackPanel>
33+
</StackPanel>
34+
</Window>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using Microsoft.UI.Xaml;
2+
using Windows.Graphics;
3+
4+
namespace winui_app
5+
{
6+
public sealed partial class MainWindow : Window
7+
{
8+
public MainWindow()
9+
{
10+
InitializeComponent();
11+
AppWindow.Resize(new SizeInt32(800, 600));
12+
}
13+
14+
private void OnManagedCrashClick(object sender, RoutedEventArgs e)
15+
{
16+
#pragma warning disable CS0618 // Type or member is obsolete
17+
SentrySdk.CauseCrash(CrashType.Managed);
18+
#pragma warning restore CS0618
19+
}
20+
21+
private void OnNativeCrashClick(object sender, RoutedEventArgs e)
22+
{
23+
#pragma warning disable CS0618 // Type or member is obsolete
24+
SentrySdk.CauseCrash(CrashType.Native);
25+
#pragma warning restore CS0618
26+
}
27+
}
28+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6+
<PropertyGroup>
7+
<PublishProtocol>FileSystem</PublishProtocol>
8+
<Platform>ARM64</Platform>
9+
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
10+
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
11+
<SelfContained>true</SelfContained>
12+
<PublishSingleFile>False</PublishSingleFile>
13+
</PropertyGroup>
14+
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6+
<PropertyGroup>
7+
<PublishProtocol>FileSystem</PublishProtocol>
8+
<Platform>x64</Platform>
9+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
10+
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
11+
<SelfContained>true</SelfContained>
12+
<PublishSingleFile>False</PublishSingleFile>
13+
</PropertyGroup>
14+
</Project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"profiles": {
3+
"winui-app": {
4+
"commandName": "Project"
5+
}
6+
}
7+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
3+
<assemblyIdentity version="1.0.0.0" name="winui-app.app"/>
4+
5+
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
6+
<application>
7+
<!-- The ID below informs the system that this application is compatible with OS features first introduced in Windows 10.
8+
It is necessary to support features in unpackaged applications, for example the custom titlebar implementation.
9+
For more info see https://docs.microsoft.com/windows/apps/windows-app-sdk/use-windows-app-sdk-run-time#declare-os-compatibility-in-your-application-manifest -->
10+
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
11+
</application>
12+
</compatibility>
13+
14+
<application xmlns="urn:schemas-microsoft-com:asm.v3">
15+
<windowsSettings>
16+
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
17+
</windowsSettings>
18+
</application>
19+
</assembly>

0 commit comments

Comments
 (0)