2015-09-18 159 views
10

我正在使用VS 2012进行调试的WPF应用程序。 由于我切换到Visual Studio 2015,因此无法再调试它。在运行时,我得到System.Windows.Markup.XamlParseException和应用程序崩溃。 需要注意的是编译好的可执行文件在双击图标启动时运行正确。我甚至可以在VS 2015中通​​过在启动后附加进程来调试它。XamlParseException在使用Visual Studio 2015调试WPF应用程序时

在我的应用程序中,我使用了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集成调试器工作?

谢谢!

+0

注意:我用ILSpy打开了xceed.wpf.toolkit.dll组件,我可以确认它包含了rource'xceed.wpf.toolkit; v2.1.0.0; themes/xceed.wpf.toolkit; v2 .1.0.0; component/themes/aero/brushes_normalcolor.xaml' –

回答

13

我禁用了

调试|一般|为XAML启用UI调试工具

选项和一切开始再次工作。

enter image description here

+0

也许这篇文章可能很有用:http://blogs.msdn.com/b/visualstudio/archive/2015/02/24/introducing-the-ui -debugging-tools-for-xaml.aspx –

+0

我有这个问题,并且此修补程序正在为我工​​作。谢啦 ! – shanmugharaj

0

您可能要检查this

,并使用pack:...语法。

原因是工具包中存在一个问题,这只会使VS2015出问题,而不能用于以前的版本。 仍然必须了解VS的最新版本和以前的版本之间的差异,但至少这个补丁的作品。

相关问题