c# – VS调试器无法正常工作
发布时间:2020-12-15 17:20:19 所属栏目:百科 来源:网络整理
导读:当我调试我的ASP.NET应用程序并在断点处执行时,我无法使用Debug Watches读取类型变量.为什么?我收到错误 type The name 'type' does not exist in the current context 代码工作正常,问题只在调试时,我无法在调试时读取所有变量. var converterSubClasses =
当我调试我的ASP.NET应用程序并在断点处执行时,我无法使用Debug Watches读取类型变量.为什么?我收到错误
type The name 'type' does not exist in the current context 代码工作正常,问题只在调试时,我无法在调试时读取所有变量. var converterSubClasses = new List<Type>(); GetClassHierarhy(ref converterSubClasses,converterClass); foreach (var type in converterSubClasses) { /* break point here */ var classProperties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); /* skip code */ } 解决方法
您是否在调试以发布模式编译的代码?根据编译器使用的优化,变量类型可能实际上并不存在.确认您正在调试Debug编译的代码,然后尝试. (我尝试在发布模式下调试时,循环没有意义,整个部分都跳了起来.)
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |