使用Visual Studio 2015调试WPF应用程序时发生XamlParseException

使用Visual Studio 2015调试WPF应用程序时发生XamlParseException,wpf,debugging,visual-studio-2015,Wpf,Debugging,Visual Studio 2015,我正在使用VS2012调试一个WPF应用程序。 自从我切换到VisualStudio2015,我再也无法调试它了。在运行时,我得到System.Windows.Markup.XamlParseException,应用程序崩溃。 需要注意的是,当双击其图标启动时,编译后的可执行文件可以正确运行。我甚至可以在VS 2015中调试它,在它启动后附加进程 在我的应用程序中,我使用了xceed.wpf.toolkit 例外情况是: System.Windows.Markup.XamlParseExcept

我正在使用VS2012调试一个WPF应用程序。 自从我切换到VisualStudio2015,我再也无法调试它了。在运行时,我得到System.Windows.Markup.XamlParseException,应用程序崩溃。 需要注意的是,当双击其图标启动时,编译后的可执行文件可以正确运行。我甚至可以在VS 2015中调试它,在它启动后附加进程

在我的应用程序中,我使用了xceed.wpf.toolkit

例外情况是:

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: 
还请注意,相关组件Xceed.Wpf.Toolkit.dll(正确版本为v2.1.0.0)位于输出目录中,就在应用程序已编译的可执行文件附近

有没有建议让应用程序使用VS 2015集成调试器工作

谢谢

我禁用了

调试|常规|为XAML启用UI调试工具

选项,一切又开始工作了

您可能需要检查

并使用
pack:…
语法

事实证明,工具包中存在一个问题,只会使VS2015出现问题,而不会使以前的版本出现问题。
仍然需要了解VS的最新版本和以前版本之间的差异,但至少此修补程序可以工作。

注意:我用ILSpy打开了xceed.wpf.toolkit.dll组件,我可以确认它确实包含rource'xceed.wpf.toolkit;v2.1.0.0;themes/xceed.wpf.toolkit;v2.1.0.0;component/themes/aero/brusks\u normalcolor.xaml'也许这篇文章会有用:我有这个问题,这个修复程序对我有用。谢谢你,伙计!