开发者

InvalidOperationException - Can you get more information out of it?

I am trying to track down and error that a user had on an ASP.NET 3.5 web page. The whole error is the standard "Could not find a row that matches the given keys in the original values stored in ViewState. Ensure that the 'keys' dictionary contains unique key values that correspond to a row returned from the previous Select operation." upon updating. I understand that this means that the viewstate is complaining that it thinks there are options being posted back from the dropdown boxes that are not valid.

Here is the twist, the code for the production page hasn't been changed for almost a whole year. This is the first time this error has ever occurred according to the aspnet_WebEvents_Events table of the production page. So what I did is pulled up the project 开发者_如何转开发locally and made a copy of the user's data via SQL query on the local server. It didn't break. So I assumed that the source had been changed and not deployed. To make a long story short, I ended up making a copy on the production server for the user and changing the UserID on the bad version via SQL query again. The user thinks it is fixed and all is well but the original copy that breaks continues to break. I can not recreate this error even though I have what are exact copies of the bad rows via SQL query. Is there any way to get more information about this error? Is it possible to have the LinqDataSource tell me exactly which value it thinks is bad? TIA!


The only way would be to reproduce the error and put a breakpoint on the line that causes the Exception. You can then browse the Call Stack to see where the error actually originates.

Even though even that last statement isn't always true. Sometimes errors pop up that were caused by code executed before, such as when preparing a list of data to be saved in the DB -- if the preparation code is wrong, the code that saves to the DB will fail, and you have to painstakingly investigate the current circumstances to figure out the origin of the problem.

But the fact remains: if you cannot reproduce the error, you're unlikely to be able to fix it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜