WPF:XamlParseException->;加载资源字典时发生访问冲突

WPF:XamlParseException->;加载资源字典时发生访问冲突,wpf,access-violation,resourcedictionary,xamlparseexception,Wpf,Access Violation,Resourcedictionary,Xamlparseexception,此WPF应用程序以.NET 3.5为目标,使用Visual Studio 2010中的4.0工具构建(csc.exe版本为4.0.30319.1) 我不知道如何处理我看到的这个例外。同一个exe在所有机器上运行了几个月,但就在今天,一位客户遇到了这个问题。我无法在本地重新编程,我需要做的只是下面日志文件中的堆栈跟踪 我用VisualStudio2010制作了一个快速示例应用程序,它只在窗口中显示一个按钮,按钮内容字符串是从资源字典中提取的。这在客户的机器上起了作用,因此.NET安装似乎没有完全安

此WPF应用程序以.NET 3.5为目标,使用Visual Studio 2010中的4.0工具构建(csc.exe版本为4.0.30319.1)

我不知道如何处理我看到的这个例外。同一个exe在所有机器上运行了几个月,但就在今天,一位客户遇到了这个问题。我无法在本地重新编程,我需要做的只是下面日志文件中的堆栈跟踪

我用VisualStudio2010制作了一个快速示例应用程序,它只在窗口中显示一个按钮,按钮内容字符串是从资源字典中提取的。这在客户的机器上起了作用,因此.NET安装似乎没有完全安装在那里

关于下一步要调查什么有什么想法吗?可能是客户的某些状态。NET安装

编辑:客户执行了.NET 3.5的卸载和重新安装,解决了问题。我猜他们的安装中有一些奇怪的状态导致了这个问题

错误:

System.Windows.Markup.XamlParseException: 无法将“MainWindowViewResources.xaml”值分配给属性 对象“System.Windows.ResourceDictionary”的“源”。企图 读或写保护内存。这通常表明其他 内存已损坏。对象错误 标记文件中的“System.Windows.ResourceDictionary” "symformconfig,;component/view/mainwindowview.xaml'-> System.AccessViolationException:尝试读或写保护 记忆。这通常表示其他内存已损坏。
位于System.IO.Packaging.PackagePart.CleanupRequestedStreamList()处 System.IO.Packaging.PackagePart.GetStream(文件模式,文件访问 访问)在 System.IO.Packaging.PackWebResponse.CachedResponse.GetResponseStream() 位于System.IO.Packaging.PackWebResponse.GetResponseStream()的 System.IO.Packaging.PackWebResponse.get_ContentType()位于 MS.Internal.WpfWebRequestHelper.GetContentType(WebResponse响应)
在MS.Internal.WpfWebRequestHelper.GetResponseStream(WebRequest 请求、内容类型和内容类型)位于 System.Windows.ResourceDictionary.set_源(Uri值)--结束 内部异常堆栈跟踪---在 System.Windows.Markup.XamlParseException.ThroweException(字符串 消息,异常innerException,Int32行号,Int32 linePosition、Uri baseUri、XamlObjectId CurrentXamlObjectId、, XamlObjectIds contextXamlObjectIds,类型objectType)位于 System.Windows.Markup.XamlParseException.ThroweException(ParserContext parserContext、Int32 lineNumber、Int32 linePosition、字符串消息、, 异常(内部异常)位于 System.Windows.Markup.BamlRecordReader.ThroweExceptionWithLine(字符串 消息,异常(内部异常)位于 System.Windows.Markup.BamlRecordReader.ReadPropertyRecordBase(字符串 attribValue、Int16 attributeId、Int16 converterTypeId)位于 System.Windows.Markup.BamlRecordReader.ReadPropertyConverterRecord(BamlPropertyWithConverterRecord bamlPropertyRecord)位于 System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)在System.Windows.Markup.BamlRecordReader.Read(布尔值)中 单记录)在 System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()位于 System.Windows.Markup.TreeBuilder.Parse()位于 System.Windows.Markup.XamlReader.LoadBaml(Stream,ParserContext parserContext、对象父对象、布尔closeStream)位于 System.Windows.Application.LoadComponent(对象组件,Uri 资源定位器) Symform.Node.Configuration.MainWindowView.InitializeComponent()位于 Symform.Node.Configuration.MainWindowView..ctor()位于 Symform.Node.Configuration.App.OnStartup(StartupEventArgs e)位于 System.Windows.Application.b__0(未使用的对象)位于 System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托 回调、对象参数、布尔值(参数)位于 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(对象源, 委托回调,对象参数,布尔isSingleParameter,委托 捕手)


确保MainWindowViewResources.xaml的BuildAction设置为Page而不是Resource。您可以在“属性”面板中找到该设置。

客户卸载并重新安装了.NET 3.5,解决了该问题。我猜他们的安装中有一些奇怪的状态导致了这个问题。

谢谢你的建议。我验证了BuildAction已设置为Page,因此似乎无法解决此特定问题。昨天我遇到了相同的问题,但我必须卸载3.5、3.0和2.0,然后重新安装3.5。很奇怪。