XamlParseException in a WPF application - but only when installed on XP

My WPF application works fine on Windows 7. Installing on an XP computer causes the following error on startup:

Framework Version: v4.0.30319

Description: The process was terminated due to an unhandled exception.

Exception Information: System.Windows.Markup.XamlParseException

Stack: at System.Windows.Markup.XamlReader.RewrapException (System.Exception, System.Xaml.IXamlLineInfo, System.Uri)

in System.Windows.Markup.WpfXamlLoader.Load (System.Xaml.XamlReader, System.Xaml.IXamlObjectWriterFactory, Boolean, System.Object, System.Xaml.XamlObjectWriterSettings, System.Uri)

in System.Windows.Markup.WpfXamlLoader.LoadBaml (System.Xaml.XamlReader, Boolean, System.Object, System.Xaml.Permissions.XamlAccessLevel, System.Uri)

in System.Windows.Markup.XamlReader.LoadBaml (System.IO.Stream, System.Windows.Markup.ParserContext, System.Object, Boolean)

in System.Windows.Application.LoadComponent (System.Object, System.Uri)

in MyApplication.App.InitializeComponent ()

in MyApplication.App.Main ()

I think I might have the problem described in the answer to this question:

XamlParseException on Windows XP

since I use PresentationFramework.Aero in places. Is there a way to fix this or will I have to remove Aero? This is a pain since I use some ButtonChromes

TIA

+6
source share
4 answers

I had the same problem in Windows XP SP3, and for me the problem was resolved by setting the Copy Local property of PresentationFramework.Aero to True .

+6
source

When accessing ResourceDictionary for Aero, try specifying the fully qualified name of the assembly, not the short name of the assembly.

<ResourceDictionary Source="/PresentationFramework.Aero, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" /> 
+1
source
  • Make sure that there are no components exceptions in the constructors for any user interface (for example, codebehind for .cs files).
  • Make sure you use MVVM to throw exceptions from the ViewModel constructor.

I had a view model throwing an exception (related to the COM component [which I am going to track now!]) Which did NOTHING with Xaml. You will get a XamlParseException if creating a component based on Xaml fails - and this can be misleading.

0
source

FIX: An exception to the XAML syntax is thrown when the WPF application starts on a computer with custom English (US) regional settings.

http://support.microsoft.com/kb/968227

0
source

Source: https://habr.com/ru/post/888425/


All Articles