您的位置:首页 > Web前端 > Node.js

The requested item has been unloaded[enums in monodevelop ]

2014-08-22 11:53 330 查看
When you debug in monodevelop, if you try to watch the enum's value,you will get a warn."The requested item has been unloaded"
This is a bug in MonoDevelop, been there for ages, probably won'tbe fixed for the next few years.
I've found the following work around. For every enum in your code,you can add:
public int debugView_enumName {get {return (int) enumName; }}


This will let you then view the enum casted to an int in the watchwindow. Certainly a dirty solution, but we have to do what we canin these dark times.
or With Debug.log
privatestringPropertyDump(object variable)
{
varstringPropertyNamesAndValues = variable.GetType().GetProperties()
.Where(pi=>pi.PropertyType == typeof(string) && pi.GetGetMethod() != null)
.Select(pi=>new
{
Name=pi.Name,
Value=pi.GetGetMethod().Invoke(variable, null)
});

System.Text.StringBuilder dump = new System.Text.StringBuilder();
foreach(var pairinstringPropertyNamesAndValues)
{
stringpairAsString = string.Format("Name: {0} Value:{1}{2}", pair.Name, pair.Value, System.Environment.NewLine);
dump.Append(pairAsString);
}
returndump.ToString();
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐