3

此WPF应用程序以.NET 3.5为目标,并使用Visual Studio 2010中的4.0工具(csc.exe版本为4.0.30319.1)构建。WPF:XamlParseException - > AccessViolation加载资源字典时

我不知道该看到的例外情况。所有机器上的相同exe已经工作了数月,但就在今天,一位客户遇到了这个问题。我无法在本地复制它,我只需要从下面的日志文件中获取堆栈跟踪信息。

我用Visual Studio 2010做了一个快速示例应用程序,它只是在窗口中显示一个按钮,从资源字典中提取按钮Content字符串。这在客户机器上工作,所以它看起来.NET安装不完全在那里...

什么调查或调查未来的任何想法?也许某些客户的.NET安装状态?

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

System.Windows.Markup.XamlParseException:'MainWindowViewResources.xaml'值不能分配给对象'System.Windows.ResourceDictionary'的属性'Source'。尝试读取或写入受保护的内存。这通常表明其他内存已损坏。标记文件'symformconfig; component/view/mainwindowview.xaml'中的对象'System.Windows.ResourceDictionary'出错。 ---> System.AccessViolationException:试图读取或写入受保护的内存。这通常表明其他内存已损坏。 在System.IO.Packaging.PackagePart.CleanUpRequestedStreamsList() 在System.IO.Packaging.PackagePart.GetStream(的FileMode模式,FileAccess的访问) 在System.IO.Packaging.PackWebResponse.CachedResponse.GetResponseStream() 在系统。 IO.Packaging.PackWebResponse.GetResponseStream() 在System.IO.Packaging.PackWebResponse.get_ContentType() 在MS.Internal.WpfWebRequestHelper.GetContentType(WebResponse的响应) 在MS.Internal.WpfWebRequestHelper.GetResponseStream(WebRequest的请求,的ContentType & contentType) at System.Windows.ResourceDictionary.set_Source(Uri value) ---内部异常堆栈跟踪结束--- 在System.Windows.Markup.XamlParseExcepti on.ThrowException(String message,Exception innerException,Int32 lineNumber,Int32 linePosition,Uri baseUri,XamlObjectIds currentXamlObjectIds,XamlObjectIds contextXamlObjectIds,Type objectType) at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext,Int32 lineNumber,Int32 linePosition,String消息,Exception ExceptionException) at System.Windows.Markup.BamlRecordReader.ThrowExceptionWithLine(String message,Exception innerException) at System.Windows.Markup.BamlRecordReader.ReadPropertyRecordBase(String attribValue,Int16 attributeId,Int16 converterTypeId) at System.Windows。 Markup.BamlRecordReader.ReadPropertyConverterRecord(BamlPropertyWithConverterRecord bamlPropertyRecord) at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord) at Syste System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord) at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment() at System.Windows.Markup.TreeBuilder.Parse() at System.Windows.Markup.XamlReader.LoadBaml (Stream stream,ParserContext parserContext,Object parent,Boolean closeStream)在Symform.Node.Configuration的Symform.Node.Configuration.MainWindowView.InitializeComponent() 上的System.Windows.Application.LoadComponent(对象组件,Uri resourceLocator) 。 MainWindowView..ctor() 位于Symform.Node.Configuration.App。在System.Windows.Application的OnStartup(StartupEventArgs e) 。 < .ctor> b__0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback,Object args,Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source,Delegate callback,Object args ,Boolean isSingleParameter,Delegate catchHandler)

回答

1

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

+1

我昨天有同样的问题,但我不得不卸载3.5,3.0和2.0,然后重新安装3.5。很奇怪。 – 2010-11-09 14:31:12

1

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

+0

感谢您的意见。我证实BuildAction已经被设置为Page,所以似乎没有解决这个特殊问题。 – JBW976 2010-11-09 01:49:10