zoukankan      html  css  js  c++  java
  • 程序运行在.Net 4.0低版本上 报“System.NullReferenceException”错误

    因为程序仅在个别机器上出现“ System.NullReferenceException”问题,而在其他机器上一切运行正常,所以认为是环境问题

    具体错误信息如下:

    2018-09-14 10:12:14,355 [1] A77450B89D5443928C58B6A81A3D40B7  - System.NullReferenceException: Object reference not set to an instance of an object.
       at ***.System.Windows.Markup.IStyleConnector.Connect(Int32 connectionId, Object target)
       at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)
       at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlObjectWriter objectWriter)
       at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
       at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren)
       at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
       at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
       at System.Windows.FrameworkElement.ApplyTemplate()
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Border.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.Control.MeasureOverride(Size constraint)
       at System.Windows.Controls.TreeViewItem.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.ContextLayoutManager.UpdateLayout()
       at System.Windows.UIElement.UpdateLayout()
       at System.Windows.Interop.HwndSource.SetLayoutSize()
       at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
       at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
       at System.Windows.Window.SetRootVisual()
       at System.Windows.Window.SetRootVisualAndUpdateSTC()
       at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
       at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
       at System.Windows.Window.CreateSourceWindowDuringShow()
       at System.Windows.Window.SafeCreateWindowDuringShow()
       at System.Windows.Window.ShowHelper(Object booleanBox)
       at System.Windows.Window.Show()
    

     问题原因:

          .net 4.0不支持嵌套模板中加入event和style, 必须打补丁。

          参考 https://support.microsoft.com/zh-cn/help/2464222/fix-a-nullreferenceexception-exception-occurs-when-you-run-a-net-frame

     解决方法:

          安装.Net 4.0.3的集成补丁包(KB2464222)或更高补丁如:.Net 4.5。

  • 相关阅读:
    刷题总结——跳蚤(poj1091容斥+分解质因数)
    刷题总结——分糖(ssoj 容斥原理+逆元+快速幂+组合数求插板)
    刷题总结——旅馆(bzoj1593线段树)
    刷题总结——树的同构(bzoj4337 树上hash)
    刷题总结——骑士的旅行(bzoj4336 树链剖分套权值线段树)
    刷题总结——松鼠的新家(bzoj3631)
    mysql备份与恢复
    nginx添加用户验证(访问服务器是的用户名密码)
    df命令
    org.mongodb.morphia.query.QueryException: sorting is not allowed for updates.
  • 原文地址:https://www.cnblogs.com/shenchao/p/9647153.html
Copyright © 2011-2022 走看看