因为程序仅在个别机器上出现“ 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。

程序运行在.Net 4.0低版本上 报“System.NullReferenceException”错误的更多相关文章

  1. 从高版本JDK换成低版本JDK报错Unsupported major.minor version 52.0的解决方案

    从高版本JDK换成低版本JDK报错Unsupported major.minor version 52.0 java.lang.UnsupportedClassVersionError: PR/Sor ...

  2. 关于微信小程序开发环境苹果IOS真机预览报SSL协议错误问题解决方案

                              微信小程序开发环境苹果IOS真机预览报SSL协议错误问题 原文来自:https://blog.csdn.net/qq_27626333/articl ...

  3. 从高版本JDK换成低版本JDK报错Unsupported major.minor version 52.0

    ava.lang.UnsupportedClassVersionError: PR/Sort : Unsupported major.minor version 52.0这个错误是由于高版本的java ...

  4. 使用官方Android-support-v7在低版本上使用ActionBarActivity

    昨天晚上更新了下Android SDK Manager,发现Extras下的Android Support Library已经更新到19.1了,上网一查原来是sdk\extras\android\su ...

  5. android中如何在低版本(5.0之前)上使用tint(着色)属性

    1. 使用app前缀(app:backgroundTint,app:backgroundTintMode),如果使用android前缀,在低版本上是拿不到值的,因为这些属性是5.0以后才加入的. 2. ...

  6. 21ic编辑推荐:从单片机开始的程序运行

    一直不清楚单片机中程序的执行过程,就是知道一个程序总是从一个main函数开始执行,然后把程序段存放在ROM里面,动态数据存放在RAM里面,而单片机的RAM资源又是及其的稀少,所以要省着用,但是到底怎么 ...

  7. 在高版本SDK中打开现存低版本SDK工程

    直接打开低版本SDK工程会出现错误提示:“Unable to resolve target 'android-xx” 解决方法: 1.将project.properties文件中的“target=an ...

  8. 用VC2010以上版本编译可以在低版本XP和2003的运行程序的方法

    2013-09-17   作者:佚名   来源:本站整理   浏览:2001   评论:1   一直以来倍受此事困拢,vc2010以上版本编译出的exe或dll总是会引用kernel32.dll的En ...

  9. Qt官方开发环境生成的exe发布方式--使用windeployqt(windeployqt是单独的程序,放在低版本qt4目录下也可以运行的)

    Qt 官方开发环境使用的动态链接库方式,在发布生成的exe程序时,需要复制一大堆 dll,如果自己去复制dll,很可能丢三落四,导致exe在别的电脑里无法正常运行.因此 Qt 官方开发环境里自带了一个 ...

随机推荐

  1. java设计模式之-观察者模式(发布-订阅模式)

    1.观察者模式定义  观察者模式定义了一种一对多的依赖关系,让多个观察者对象同时监听某一个主题对象. 这个主题对象在状态上发生变化时,会通知所有观察者对象,让它们能够自动更新自己. 2.观察者模式结构 ...

  2. [ 高危 ] hash碰撞DOS漏洞

    这是一个很神奇的漏洞 hotel.meituan.com订单页面,POST提交的是一串json数据.当把这串数据换成json碰撞数据 后,服务器原本 100毫秒可以响应的数据包,变成需要30秒才能响应 ...

  3. Django 学习第五天——自定义过滤器及标签

    代码布局:(自定义的代码放在哪?) 1.创建某个 app 特有的: 在 app 目录下,创建 templatetags python包(文件夹): 再到 templatetags 文件夹下创建pyth ...

  4. mysql数据库操作语句整合

    查看版本:select version();显示当前时间:select now(); 注意:在语句结尾要使用分号; 远程连接 一般在公司开发中,可能会将数据库统一搭建在一台服务器上,所有开发人员共用一 ...

  5. linux 学习笔记 软件包管理

    >查询文件所属软件包 #rpm -qf /usr/share/pixmaps/xplns.png 查询某个文件所属软件包 >查询软件包所包含文件列表 #rpm -ql xplus-3.3. ...

  6. XamarinSQLite教程在Xamarin.Android项目中提取数据库文件

    XamarinSQLite教程在Xamarin.Android项目中提取数据库文件 由于不能直接打开该文件,开发者需要先将数据库文件从Android系统中提取出来.操作步骤如下. (5)选择MyDoc ...

  7. 简单总结下opacity、transparent以及rgba

    这几个概念最开始学的时候只是有个大致印象,现在复习这部分的知识点,发现不仔细区分一下,还真有点混乱. 三者共同点是都和透明有关.先分着来说一下: 1.opacity用来设置元素的不透明级别,从 0.0 ...

  8. 37_Reverse3_digit_Integer

    描述 反转一个只有3位数的整数. 你可以假设输入一定是一个只有三位数的整数,这个整数大于等于100,小于1000. [ ] 您在真实的面试中是否遇到过这个题? 样例 123 反转之后是 321. 90 ...

  9. Systick时钟定时

    主函数 /* Note:Your choice is C IDE */ #include "stdio.h" #include "led.h" void mai ...

  10. React入门——制作一个TodoList App

    源码 import React, { Component, Fragment } from "react"; class TodoList extends Component { ...