我正在做一个WPF应用程序,其中应用程序需要从Web服务中获取数据。这些应用程序可以在我的visual studio中运行,但数据获取需要5秒以上。但是,在我发布并试用另一台电脑后,只要我点击搜索按钮,应用就会崩溃。我是否需要实施try& amp;抓方法?有什么建议吗?
搜索按钮的代码段:
private void serachBtn_Click(object sender, RoutedEventArgs e)
{
StoreApi.WebService myApi = new StoreApi.WebService();
var dbs = myApi.GetStorageInfo(0);
var query = from p in dbs
select new
{
Name = p.ProductName,
Price = p.ProductPrice,
};
myProductDataGrid.ItemsSource = query;
}
崩溃程序的图片:
问题详情:
Problem Event Name: CLR20r3
Problem Signature 01: beaconproject.exe
Problem Signature 02: 1.0.0.0
Problem Signature 03: 50dc1b77
Problem Signature 04: mscorlib
Problem Signature 05: 4.0.30319.17929
Problem Signature 06: 4ffa561c
Problem Signature 07: 2f1a
Problem Signature 08: 23
Problem Signature 09: System.FormatException
OS Version: 6.1.7601.2.1.0.256.4
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
答案 0 :(得分:0)
尝试保留一个记录代码中每一步的错误记录器。可以是一个txt文件。执行每一行后,请保持状态。最好还有尝试捕获。因此,您也可以获得更多详细信息。