C# 我的应用程序在与ListView中的项目进行快照时崩溃
因此,我目前正在为一个Windows8应用商店应用程序使用C#/XAML进行一个项目,我遇到了一个问题 当用户导航到某个页面时,将显示带有一些控件的ListView。 然后,当用户决定抓拍页面时,我的应用程序崩溃并显示: 在我的IntelliTrace中,这会显示,我按下一个异常 它引导我找到这个代码C# 我的应用程序在与ListView中的项目进行快照时崩溃,c#,windows-8,microsoft-metro,windows-store-apps,windows-applications,C#,Windows 8,Microsoft Metro,Windows Store Apps,Windows Applications,因此,我目前正在为一个Windows8应用商店应用程序使用C#/XAML进行一个项目,我遇到了一个问题 当用户导航到某个页面时,将显示带有一些控件的ListView。 然后,当用户决定抓拍页面时,我的应用程序崩溃并显示: 在我的IntelliTrace中,这会显示,我按下一个异常 它引导我找到这个代码 /// <summary> /// Implement this partial method to configure the service endpoint
/// <summary>
/// Implement this partial method to configure the service endpoint.
/// </summary>
/// <param name="serviceEndpoint">The endpoint to configure</param>
/// <param name="clientCredentials">The client credentials</param>
static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials);
public EmployeeAssisterClient() :
base(EmployeeAssisterClient.GetDefaultBinding(), EmployeeAssisterClient.GetDefaultEndpointAddress()) {
this.Endpoint.Name = EndpointConfiguration.TimeLoggerEndPoint.ToString();
ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
}
编辑==============================================================================
这就是抛出的错误
我通过在Cmd中键入“C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\VsDiag\u regwcf.exe-u”关闭了WCF调试,解决了2/3的问题
这是我的IntelliTrace中的最后一个错误:
这个错误意味着什么?有人知道如何解决这个问题吗?根据您的演示,您可能使用了生成的页面(来自模板),然后删除了其中的一些Xaml,这很好 您可能没有做的事情是删除对那些从VisualStateManager的故事板中删除的控件的引用,特别是对于快照状态
转到您的页面并检查(通常在底部)Xaml中的“快照”VisualState,然后检查并查看是否有任何情节提要具有不再具有的控件的TargetName。请参阅Visual studio 2012中的“本地人”窗格,您会注意到一个名为$exception的值。它的价值是什么。看这是我的本地人在应用程序崩溃时的样子:它是
ArgumentException
抛出的。我应该在哪里捕捉ArgumentException?在航行中?谢谢你的回复。我使用了基本页面,它为我生成了一个backButton和一个pageTitle。但是当我从页面中删除这些内容时,我也从我的故事板中删除了它们。(我的故事板只包含4个目标名称:“FullView、SnaptView、FillView和肖像视图”(我的4个视觉状态中都有这些故事板)。
_timeReports = _timeReportDatabase.GetAll();
foreach (var timeReport in _timeReports)
{
_invoicedControls.Add(new InvoicedControl(timeReport)
{
Customer = timeReport.CustomerName,
Date = timeReport.Date,
WorkedTime = timeReport.WorkedTime.ToString(),
InvoicedTime = timeReport.InvoicedTime.ToString()
});
}
TimeReportsListViewFillView.ItemsSource = _invoicedControls;
TimeReportsListViewFullView.ItemsSource = _invoicedControls;
TimeReportsListViewPortraitView.ItemsSource = _invoicedControls;
TimeReportsListViewSnappedView.ItemsSource = _invoicedControls;