I
I
iki900092018-02-17 15:09:19
WPF
iki90009, 2018-02-17 15:09:19

How to fix Exception thrown: 'System.Windows.Markup.XamlParseException' error in PresentationFramework?

The project runs fine from VS.
But error when run with power shell
C:\Windows\system32> c:\project\Clicker\bin\x86\Debug\Clicker.exe
or Process.Start()
Exception thrown: 'System.Windows.Markup.XamlParseException' in PresentationFramework.dll
Additional information: "A constructor call on type 'Clicker.MainWindow' that satisfies the specified binding constraints resulted in an exception being thrown.": line number '10' and line position '2'.
line 10: But this works fine : cd c:\project\Clicker\bin\x86\Debug c:\project\Clicker\bin\x86\Debug\Clicker.exe
xmlns:localGgui="clr-namespace:GLib;assembly=GLib"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mindgrow, 2018-02-17
@mindgrow

Try modifying the application startup code as in the example below
namespace WpfApplication1
{
///
/// Interaction logic for App.xaml
///
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
// hook on error before app really starts
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
base.OnStartup(e);
}
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
// put your tracing or logging code here (I put a message box as an example)
MessageBox.Show(e.ExceptionObject.ToString());
}
}
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question