- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我在打开新窗口的大型程序中有一个菜单项。没有任何内容传递给它,它加载一个日历、3 个空文本框、3 个标签、2 个按钮和一个空的 Crystal Report Viewer。
当它运行时,用户点击日历,这会自动将所选月份的第一个和最后一个日期插入到两个文本框中。一个按钮使用数据库中的数据加载 CR 报告,另一个按钮打印报告。
这在我的系统上运行良好,但在同事系统上部署时初始化组件抛出空引用异常。我无法在我的系统上重新创建异常。
有人知道我应该从哪里开始吗?
已更新
错误
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Windows.Baml2006.Baml2006Reader.Process_PropertyWithConverter()
at System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
at System.Windows.Baml2006.Baml2006Reader.Process_BamlRecords()
at System.Windows.Baml2006.Baml2006Reader.Read()
at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at KeyInScreen.RebatesReports.InitializeComponent()
at KeyInScreen.RebatesReports..ctor()
at KeyInScreen.Menu.FertiliserRebate_Click(Object sender, RoutedEventArgs e)
XAML 代码
<Window x:Class="KeyInScreen.RebatesReports"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Fertiliser Rebates" WindowState="Maximized"
xmlns:my="clr-namespace:SAPBusinessObjects.WPF.Viewer;assembly=SAPBusinessObjects.WPF.Viewer"
mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Height="700"
Width="1350">
<Window.Resources>
<Style TargetType="{x:Type Label}">
<Setter Property="FontSize" Value="14" />
</Style>
<Style TargetType="{x:Type Button}">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="{x:Type Calendar}">
<Setter Property="FontSize" Value="14"/>
</Style>
<Style TargetType="{x:Type TextBox}">
<Setter Property="FontSize" Value="14"/>
</Style>
</Window.Resources>
<Grid Background="#FFEFEDDF">
<Grid.RowDefinitions>
<RowDefinition Height=".5*"/>
<RowDefinition Height=".5*"/>
<RowDefinition Height="4*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".2*"/>
<ColumnDefinition Width=".7*"/>
<ColumnDefinition Width=".7*"/>
<ColumnDefinition Width=".7*"/>
<ColumnDefinition Width=".5*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width=".1*"/>
</Grid.ColumnDefinitions>
<Calendar x:Name="cDatePicker" Grid.Column="1" Grid.Row="2" Grid.RowSpan="2" Grid.ColumnSpan="2" SelectedDatesChanged="cDatePicker_SelectedDatesChanged" />
<Label Content="Start Date:" Grid.Column="1" Grid.Row="4" Margin="5"/>
<TextBox x:Name="txtStartDate" Grid.Column="2" Grid.Row="4" Margin="5" VerticalContentAlignment="Center" />
<Label Content="End Date:" Grid.Column="1" Grid.Row="5" Margin="5"/>
<TextBox x:Name="txtEndDate" Grid.Column="2" Grid.Row="5" Margin="5" VerticalContentAlignment="Center"/>
<Label Content="Supplier Number:" Grid.Column="1" Grid.Row="6" Margin="5"/>
<TextBox x:Name="txtCustomerNumber" Grid.Column="2" Grid.Row="6" Margin="5" VerticalContentAlignment="Center" TabIndex="1" />
<Button x:Name="btnShowRport" Content="View Report" Grid.Column="1" Grid.Row="8" Margin="0,0,10,0" Click="btnShowRport_Click" IsDefault="True" />
<Button x:Name="btnPrintReport" Content=" Print Report" Grid.Column="2" Grid.Row="8" Margin="10,0,0,0" Click="btnPrintReport_Click" />
<my:CrystalReportsViewer x:Name="crReportViewer" Grid.Column="3" Grid.RowSpan="10" HorizontalAlignment="Center" VerticalAlignment="Center"
Height="656" Width="845" Margin="94,-7,62,12" ToggleSidePanel="None" Panel.ZIndex="0" Grid.ColumnSpan="3"
ShowPrintButton="False" ShowRefreshButton="False" ShowSearchTextButton="False" ShowToggleSidePanelButton="True"
ShowToolbar="True" ShowNextPageButton="True" ShowGoToPageButton="True" ShowExportButton="False"
ShowCopyButton="False" SnapsToDevicePixels="True" ShowLogo="False" ShowPrevPageButton="True"
ShowStatusbar="True" />
</Grid>
谢谢
最佳答案
有点晚了,但是当你得到像这样的空引用异常时,它可能会产生误导。内部异常可能为空(在我的情况下。)
我发现这个问题的方法是在 VS 2010 中启用第一次机会异常。
转到 调试 -> 异常
然后选中所有复选框。
关于c# - 初始化组件抛出空引用异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6424236/
我是 Spring 新手,这就是我想要做的事情: 我正在使用一个基于 Maven 的库,它有自己的 Spring 上下文和 Autowiring 字段。 它的bean配置文件是src/test/res
我在我的测试脚本中有以下列表初始化: newSequenceCore=["ls", "ns", "*", "cm", "*", "ov", "ov", "ov", "ov", "kd"] (代表要在控
这个问题在这里已经有了答案: 关闭 11 年前。 Possible Duplicate: Class construction with initial values 当我查看 http://en.
我得到了成员变量“objectCount”的限定错误。编译器还返回“ISO C++ 禁止非常量静态成员的类内初始化”。这是主类: #include #include "Tree.h" using n
我有如下所示的a.h class A { public: void doSomething()=0; }; 然后我有如下所示的b.h #include "a.h" class b: publi
我需要解析 Firebase DataSnapshot (一个 JSON 对象)转换成一个数据类,其属性包括 enum 和 list。所以我更喜欢通过传递 DataSnapshot 来手动解析它进入二
我使用 JQuery 一段时间了,我总是使用以下代码来初始化我的 javascript: $(document).ready( function() { // Initalisation logic
这里是 Objective-C 菜鸟。 为什么会这样: NSString *myString = [NSString alloc]; [myString initWithFormat:@"%f", s
我无法让核心数据支持的 NSArrayController 在我的代码中正常工作。下面是我的代码: pageArrayController = [[NSArrayController alloc] i
我对这一切都很陌生,并且无法将其安装到我的后端代码中。它去哪里?在我的页脚下面有我所有的 JS? 比如,这是什么意思: Popup initialization code should be exec
这可能是一个简单的问题,但是嘿,我是初学者。 所以我创建了一个程序来计算一些东西,它目前正在控制台中运行。我决定向其中添加一个用户界面,因此我使用 NetBeans IDE 中的内置功能创建了一个 J
我有 2 个 Controller ,TEST1Controller 和 TEST2Controller 在TEST2Controller中,我有一个initialize()函数设置属性值。 如果我尝
据我所知, dependentObservable 在声明时会进行计算。但如果某些值尚不存在怎么办? 例如: var viewModel ={}; var dependentObservable1 =
我正在阅读 POODR 这本书,它使用旧语法进行默认值初始化。我想用新语法实现相同的功能。 class Gear attr_reader :chainring, :cog, :wheel de
我按照 polymer 教程的说明进行操作: https://www.polymer-project.org/3.0/start/install-3-0 (我跳过了可选部分) 但是,在我执行命令“po
很抱歉问到一个非常新手的Kotlin问题,但是我正在努力理解与构造函数和初始化有关的一些东西。 我有这个类和构造函数: class TestCaseBuilder constructor(
假设我们有一个包含 30 列和 30 行的网格。 生命游戏规则简而言之: 一个小区有八个相邻小区 当一个细胞拥有三个存活的相邻细胞时,该细胞就会存活 如果一个细胞恰好有两个或三个活的相邻细胞,那么它就
我是 MQTT 和 Android 开放附件“AOA” 的新手。在阅读教程时,我意识到,在尝试写入 ByteArrayOutputStream 类型的变量之前,应该写入 0 或 0x00首先到该变量。
我有 2 个 Controller ,TEST1Controller 和 TEST2Controller 在TEST2Controller中,我有一个initialize()函数设置属性值。 如果我尝
我有一个inotify /内核问题。我正在使用“inotify” Python项目进行观察,但是,我的问题仍然是固有的关于inotify内核实现的核心。 Python inotify项目处理递归ino
我是一名优秀的程序员,十分优秀!