C
C#2mo ago
Peggun

WinUI 3 App.g.i.cs Autogen File breaking?

I am trying to create a WinUI 3 Application and I added some code and now the autogenerated file App.g.i.cs throws a break. Here is the code that breaks it, and e, doesnt have a stack trace App.g.i.cs
#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
UnhandledException += (sender, e) =>
{
if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
};
#endif
#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
UnhandledException += (sender, e) =>
{
if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
};
#endif
I have a feeling its something to do with InitializeComponent but im not sure. Here are the errors
No description
5 Replies
ACiDCA7
ACiDCA72mo ago
well in the code you added do you have any warnings or so? i would asume something xamlrelated
Peggun
Peggun2mo ago
well this is my mainwindow.xaml and mainwindow.xaml.cs
<?xml version="1.0" encoding="utf-8" ?>
<Window
x:Class="UTD.WindowsGUI.MainWindow"
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:local="using:UTD.WindowsGUI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<StackPanel>

</StackPanel>
</Window>
<?xml version="1.0" encoding="utf-8" ?>
<Window
x:Class="UTD.WindowsGUI.MainWindow"
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:local="using:UTD.WindowsGUI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<StackPanel>

</StackPanel>
</Window>
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using UTD.Core.Models;
using Microsoft.UI.Xaml.Media.Animation;
using Windows.Devices.Input;
using UTD.Startup;
using System.Diagnostics;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace UTD.WindowsGUI
{
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using UTD.Core.Models;
using Microsoft.UI.Xaml.Media.Animation;
using Windows.Devices.Input;
using UTD.Startup;
using System.Diagnostics;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace UTD.WindowsGUI
{
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
for now its just the default. some times when i create the project again with complete defaults it does the same thing. its like its random I also get this error after stopping the Debug session in the Debug Console which could be related? Exception thrown: 'System.Runtime.InteropServices.COMException' in WinRT.Runtime.dll WinRT information: The application called an interface that was marshalled for a different thread. but doesnt show for e as a stack trace i have no warnings or errors in either code
sibber
sibber2mo ago
$vsdrunk
MODiX
MODiX2mo ago
* close VS * remove the hidden folder .vs * remove all bin and obj folder next to each csproj (DO NOT TOUCH THE .git FOLDER OR WHAT'S INSIDE) * restart vs
Peggun
Peggun2mo ago
that still didnt work. this is the stack frame for it
UTD.WindowsGUI.dll!UTD.WindowsGUI.App.InitializeComponent.AnonymousMethod__4_2(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e) Line 69 C#
and i added a textblock to the stack panel too dont worry about this anymore, turns out Microsoft.UI.Xaml NuGet package was causing all of the issues
Want results from more Discord servers?
Add your server