简体   繁体   English

在Visual Studio中跟踪错误

[英]Tracing an error in Visual Studio

First time posting a question so I hope I do this right. 第一次发布问题,希望我做对。 The main problem is that I cannot trace the error created when opening a form and would like advice on how to find the code triggering the problem. 主要问题是我无法跟踪打开表单时创建的错误,并且希望获得有关如何找到触发问题的代码的建议。 I'm pasting the error below all this. 我将错误粘贴在所有这些下面。 Unfortunately this isn't the error that points to a specific line of code so I feel stuck. 不幸的是,这并不是指向特定代码行的错误,因此我感到困惑。

I also may need provide more background on this. 我可能还需要为此提供更多背景信息。 I recently received a new computer and have been getting all my applications reinstalled. 我最近收到了一台新计算机,并且已经重新安装了所有应用程序。 When I opened the project behind my web site (which is running fine) and ran it I received an error that told me the variable name could not contain spaces. 当我打开网站后面的项目(运行正常)并运行它时,我收到一条错误消息,告诉我变量名不能包含空格。 OK fine, I fixed it with brackets but then wondered why this is the first time I saw this error. 好的,我用方括号固定了它,但是想知道为什么这是我第一次看到此错误。 I pulled up the version of code that is running and found that the variable name is not bracketed. 我提取了正在运行的代码的版本,发现变量名称未括在方括号中。 Very strange, so I guess one side question would be why this is. 非常奇怪,所以我想一个侧面的问题是为什么会这样。 Here are the versions I have in the event it is relevant: 如果相关,我会提供以下版本:

Microsoft Visual Studio 2010 Version 10.0.30319.1 RTMRel Microsoft .NET Framework Version 4.0.30319 RTMRel Installed Version: Professional Microsoft Visual Studio 2010版本10.0.30319.1 RTMRel Microsoft .NET Framework版本4.0.30319 RTMRel安装版本:专业版

Below is the error I receive. 以下是我收到的错误。 Since this isn't one that I can step through (as far as I know) I would simply like to learn how to go about finding this. 由于这不是我可以逐步解决的问题(据我所知),我只想学习如何找到它。 Would be great if I understood why this wasn't a problem before, since I haven't changed anything yet! 如果我之前知道为什么这不是问题,那太好了,因为我还没有做任何更改!

*Exception Details: System.FormatException: Input string was not in a correct format. *异常详细信息:System.FormatException:输入字符串的格式不正确。 Source Error: An unhandled exception was generated during the execution of the current web request. 源错误:当前Web请求的执行期间生成了未处理的异常。 Information regarding the origin and location of the exception can be identified using the exception stack trace below. 可以使用下面的异常堆栈跟踪来标识有关异常的来源和位置的信息。 Stack Trace: [FormatException: Input string was not in a correct format.] 堆栈跟踪:[FormatException:输入字符串的格式不正确。
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +9591147 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119 System.Number.StringToNumber(字符串str,NumberStyles选项,NumberBuffer&数字,NumberFormatInfo信息,布尔值parseDecimal)+9591147 System.Number.ParseInt32(String s,NumberStyles样式,NumberFormatInfo信息)+119
System.String.System.IConvertible.ToInt32(IFormatProvider provider) +46 System.Convert.ChangeType(Object value, TypeCode typeCode, IFormatProvider provider) +297 System.String.System.IConvertible.ToInt32(IFormatProvider提供程序)+46 System.Convert.ChangeType(对象值,TypeCode typeCode,IFormatProvider提供程序)+297
System.Web.UI.WebControls.Parameter.GetValue(Object value, String defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean ignoreNullableTypeChanges) +126 System.Web.UI.WebControls.Parameter.GetValue(对象值,字符串defaultValue,TypeCode类型,布尔值convertEmptyStringToNull,布尔值ignoreNullableTypeChanges)+126
System.Web.UI.WebControls.Parameter.GetValue(Object value, Boolean ignoreNullableTypeChanges) +63 System.Web.UI.WebControls.Parameter.GetValue(对象值,布尔值ignoreNullableTypeChanges)+63
System.Web.UI.WebControls.Parameter.get_ParameterValue() +40 System.Web.UI.WebControls.Parameter.get_ParameterValue()+40
System.Web.UI.WebControls.ParameterCollection.GetValues(HttpContext context, Control control) +261 System.Web.UI.WebControls.ParameterCollection.GetValues(HttpContext上下文,控制控件)+261
System.Web.UI.WebControls.SqlDataSourceView.InitializeParameters(DbCommand command, ParameterCollection parameters, IDictionary exclusionList) +266 System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +653 System.Web.UI.WebControls.SqlDataSourceView.InitializeParameters(DbCommand命令,ParameterCollection参数,IDictionary exclusionList)+266 System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments参数)+653
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments参数,DataSourceViewSelectCallback回调)+21
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143 System.Web.UI.WebControls.DataBoundControl.PerformSelect()+143
Telerik.Web.UI.GridTableView.PerformSelect() +38 Telerik.Web.UI.GridTableView.PerformSelect()+38
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74 System.Web.UI.WebControls.BaseDataBoundControl.DataBind()+74
Telerik.Web.UI.GridTableView.DataBind() +375 Telerik.Web.UI.GridTableView.DataBind()+375
Telerik.Web.UI.RadGrid.DataBind() +173 Telerik.Web.UI.RadGrid.DataBind()+173
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()+66
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75 System.Web.UI.Control.EnsureChildControls() +102 System.Web.UI.Control.PreRenderRecursiveInternal() +42 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls()+75 System.Web.UI.Control.EnsureChildControls()+102 System.Web.UI.Control.PreRenderRecursiveInternal()+42
System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal()+175
System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal()+175
System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal()+175
System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal()+175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496* System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+ 2496 *

Thanks for any guidance you might be able to provide 感谢您提供的指导

Dana 达纳

You couldn't hit this line because it's not your code. 您无法点击此行,因为它不是您的代码。 It didn't break in the markup because it was syntactically correct. 它在标记中没有中断,因为它在语法上是正确的。 It broke further down the line because the code was semantically incorrect. 由于代码在语义上是不正确的,因此进一步中断了代码。

I believe I found the problem causing the error. 我相信我找到了导致错误的问题。 Turns out I did change something on one of the dropdowns and hadn't realized. 原来我确实对其中一个下拉菜单进行了更改,但没有意识到。 Took my quite a while of commenting out code until I could isolate the problem. 我花了相当长的时间注释掉代码,直到找到问题所在。

Thanks to the helpful replies. 感谢有用的答复。

I'm still wondering why it was unable to point to the line causing the problem in the markup, like it does for the code-behind. 我仍然想知道为什么它无法指向导致标记问题的行,就像后面的代码一样。 No way to do that? 没办法吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM