WPF应用程序功能区崩溃

4

我在Visual Studio 2008中创建了一个包含多个窗口的程序。其中一个窗口使用Windows Ribbon控件。现在,该程序在我的计算机(Windows XP)上运行良好,但当我想在安装了.NET 3.5 SP1的另一台计算机上运行它时,我可以启动该程序,但当我打开带有Ribbon控件的窗口时就会崩溃。 这是我在try catch中获取的错误文件:

System.Windows.Markup.XamlParseException: 目标调用的异常已经被抛出。对象'System.Windows.Data.Binding'错误 ---> System.Reflection.TargetInvocationException: 目标调用的异常已经被抛出。---> System.ComponentModel.Win32Exception: HRESULT_FROM_WIN32(ERROR_NOT_FOUND) Standard.HRESULT.ThrowIfFailed(String message) Microsoft.Windows.Shell.SystemParameters2._InitializeThemeInfo() Microsoft.Windows.Shell.SystemParameters2..ctor() Microsoft.Windows.Shell.SystemParameters2.get_Current() --- 内部异常堆栈跟踪结束 --- 在System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) 在System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) 在System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) 在System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)<br/> 在System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) 在System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) 在System.Windows.Markup.StaticExtension.ProvideValue(IServiceProvider serviceProvider) 在System.Windows.Markup.BamlRecordReader.GetStaticExtensionValue(Int16 memberId) 在System.Windows.Markup.BamlRecordReader.GetExtensionValue(IOptimizedMarkupExtension optimizedMarkupExtensionRecord, String propertyName) 在System.Windows.Markup.TemplateBamlRecordReader.ReadPropertyWithExtensionRecord(BamlPropertyWithExtensionRecord bamlPropertyRecord) 在System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord) --- 内部异常堆栈跟踪结束 --- 在System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType) 在System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException) 在System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord) 在System.Windows.Markup.TemplateBamlRecordReader.ReadNonContentRecord(BamlRecord bamlRecord) 在System.Windows.Markup.TemplateBamlRecordReader.ReadRecord(BamlRecord bamlRecord) 在System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord) 在System.Windows.Markup.TemplateTreeBuilderBamlTranslator.ParseFragment() 在System.Windows.Markup.TreeBuilder.Parse() 在System.Windows.Markup.XamlTemplateSerializer.ConvertBamlToObject(BamlRecordReader reader, BamlRecord bamlRecord, ParserContext context) 在System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord) 在System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord) 在System.Windows.Markup.BamlRecordReader.ReadElement(Int64 startPosition, XamlObjectIds contextXamlObjectIds, Object dictionaryKey) 在System.Windows.ResourceDictionary.CreateObject(Int32 valuePosition, Object key) 在System.Windows.ResourceDictionary.RealizeDeferContent(Object key, Object& value, Boolean& canCache) 在System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache) 在System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache) 在System.Windows.DeferredThemeResourceReference.GetValue(BaseValueSourceInternal valueSource) 在System.Windows.DependencyPropertyChangedEventArgs.get_NewValue() 在System.Windows.Controls.Control.OnTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 在System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) 在System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) 在System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) 在System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, OperationType operationType) 在System.Windows.StyleHelper.ApplyStyleOrTemplateValue(FrameworkObject fo, DependencyProperty dp) 在System.Windows.StyleHelper.InvalidateContainerDependents(DependencyObject container, FrugalStructList1& exclusionContainerDependents, FrugalStructList1& oldContainerDependents, FrugalStructList`1& newContainerDependents) 在System.Windows.StyleHelper.DoThemeStyleInvalidations(FrameworkElement fe, FrameworkContentElement fce, Style oldThemeStyle, Style newThemeStyle, Style style) 在System.Windows.StyleHelper.Update

有没有人之前遇到过这个错误或者有什么提示可以帮助我解决?我已经删除了.NET并重新安装它。


重新安装.NET是无效的。XAML中有绑定问题。 - Ian
问题在于该应用程序可以在我的开发计算机上运行,但无法在我想要安装该程序的计算机上运行。 - pieter.lowie
我在另一台机器上安装了相同版本的功能区(Microsoft Ribbon for WPF october 2010 (version 4.0.0...))。我在Visual Studio 2008 .net 3.5上使用这个版本会有问题吗? 即使我已经安装了这个版本,我仍然遇到了问题。我还检查了我的.net语言包,并在其他机器上安装了与开发机器相同的语言包。 - pieter.lowie
解决我的问题的唯一方法是重新设计用户界面,不使用功能区界面 :(. 如果有人对这个问题有答案,请在这里发布。对其他人可能会有帮助。 - pieter.lowie
很抱歉,我无法提供解决方案,因为在项目中我没有使用功能区选项卡,因为我找不到解决问题的方法。 - pieter.lowie
显示剩余2条评论
1个回答

1

您的异常与我遇到的异常有所不同(XamlParseException:在“System.Windows.Markup.StaticExtension”上提供值引发了异常),但我认为您应该查看我的答案在这里


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接