Reputation: 18087
When I debug my ASP.NET app and execution breaks at break point I can't read type
variable using Debug Watches. Why? I get error
type The name 'type' does not exist in the current context
The code works fine, the problem only in debugging, I can't read all variables while debugging.
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 */
}
Upvotes: 4
Views: 463
Reputation: 8212
Are you debugging code compiled in Release mode? Depending on the optimizations the compiler used the variable type
may not actually be there. Confirm you're debugging against Debug compiled code and try then. (I've had loops not make sense and entire sections get jumped when trying to debug in release mode.)
Upvotes: 2