Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XamlParseException when debugging WPF application with Visual Studio 2015

I'm working on a WPF application I used to debug with VS 2012. Since I switched to Visual Studio 2015, I don't manage to debug it any more. At runtime I get System.Windows.Markup.XamlParseException and the application crashes. To be noted that the compiled executable runs correctly when launched by double-clicking on its icon. I can even debug it in VS 2015 by attaching the process after it's been launched.

In my application I make use of xceed.wpf.toolkit.

The exception is:

System.Windows.Markup.XamlParseException occurred
  HResult=-2146233087
  LineNumber=58
  LinePosition=15
  Message='Initialization of 'Xceed.Wpf.Toolkit.BusyIndicator' threw an exception.' Line number '58' and line position '15'.
  Source=PresentationFramework
  StackTrace:
       at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
       at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
       at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
       at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
       at [...].InitializeComponent()
  InnerException: 
       HResult=-2146233088
       LineNumber=0
       LinePosition=0
       Message=Initialization of 'Xceed.Wpf.Toolkit.Core.VersionResourceDictionary' threw an exception.
       Source=System.Xaml
       StackTrace:
            at MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlType xamlType, Object obj, Boolean begin)
            at System.Xaml.XamlObjectWriter.Logic_EndInit(ObjectWriterContext ctx)
            at System.Xaml.XamlObjectWriter.WriteEndObject()
            at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
            at System.Windows.SystemResources.ResourceDictionaries.LoadDictionary(Assembly assembly, String assemblyName, String resourceName, Boolean isTraceEnabled)
            at System.Windows.SystemResources.ResourceDictionaries.LoadThemedDictionary(Boolean isTraceEnabled)
            at System.Windows.SystemResources.FindDictionaryResource(Object key, Type typeKey, ResourceKey resourceKey, Boolean isTraceEnabled, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean& canCache)
            at System.Windows.SystemResources.FindResourceInternal(Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference)
            at System.Windows.StyleHelper.GetThemeStyle(FrameworkElement fe, FrameworkContentElement fce)
            at System.Windows.FrameworkElement.UpdateThemeStyleProperty()
            at System.Windows.FrameworkElement.OnInitialized(EventArgs e)
            at System.Windows.FrameworkElement.TryFireInitialized()
            at MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlType xamlType, Object obj, Boolean begin)
       InnerException: 
            HResult=-2146232800
            Message=Cannot locate resource 'xceed.wpf.toolkit;v2.1.0.0;themes/xceed.wpf.toolkit;v2.1.0.0;component/themes/aero/brushes_normalcolor.xaml'.
            Source=PresentationFramework
            StackTrace:
                 at MS.Internal.AppModel.ResourcePart.GetStreamCore(FileMode mode, FileAccess access)
                 at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
                 at System.IO.Packaging.PackWebResponse.CachedResponse.GetResponseStream()
                 at System.IO.Packaging.PackWebResponse.get_ContentType()
                 at MS.Internal.WpfWebRequestHelper.GetContentType(WebResponse response)
                 at MS.Internal.WpfWebRequestHelper.GetResponseStream(WebRequest request, ContentType& contentType)
                 at System.Windows.ResourceDictionary.set_Source(Uri value)
                 at Xceed.Wpf.Toolkit.Core.VersionResourceDictionary.System.ComponentModel.ISupportInitialize.EndInit()
                 at MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlType xamlType, Object obj, Boolean begin)
            InnerException: 

Note also that the involved component, Xceed.Wpf.Toolkit.dll (in the correct version, v2.1.0.0), IS present in the output directory, just close to the application's compiled executable.

Any suggestion to make the application to work using the VS 2015 integrated debugger?

Thanks!

like image 874
Starnuto di topo Avatar asked Sep 18 '15 10:09

Starnuto di topo


1 Answers

I disabled the

Debugging | General | Enable UI Debugging Tools for XAML

option and everything started working again.

enter image description here

like image 125
Starnuto di topo Avatar answered Oct 18 '22 23:10

Starnuto di topo