快速监视是不正确的显示可空属性的ToString工作() [英] QuickWatch is not work correctly for Showing Nullable Properties .ToString()

查看:125
本文介绍了快速监视是不正确的显示可空属性的ToString工作()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个空整型在vb.net财产
这家酒店位于code有正确的值,但在快速监视总是显示 1 ,除非我由最初它值然后显示一个六洋地黄数字。

I have a nullable integer property in vb.net.
This property in code has correct value, but in the QuickWatch always display 1, unless I initial it by a value then display a six digitalis numbers.

我的codeS是:

Public Property MyNumber As Integer?

MyNumber = 6546

MessageBox.Show(MyNumber.ToString())

和对于为空的双重属性快速监视总是显示 4 / 94065645841247E-324

我测试这个在的.Net 4安培; 4.5 的Visual Studio 2010和放大器; 2013 ,并得到同样的结果。但是C#有没有这个问题。

I test this on .Net 4 & 4.5 on visual studio 2010 & 2013 and get same result. However C# hasn't this problem

编辑:

我附上我的项目结果也一样,你在监视窗口看到他们两个显示

I append my project result too, as you see in watch windows both of them is shown

为什么出现这种情况?

编辑:

这个问题是在.NET 4中和4.5和4.5.1。与.net 2.0和3.5有没有问题

This problem is with .Net 4 and 4.5 and 4.5.1. With .Net 2.0 and 3.5 has no problem

推荐答案

确认,这确实是在调试器中的一个错误。我搜索connect.microsoft.com,但没有找到任何类似,这不是罢工很多VB.NET程序员的错误。不完全令人惊讶,当你追加的ToString(),以可空变量名这只出错。从来没有人做到这一点。

Confirmed, this is indeed a bug in the debugger. I searched connect.microsoft.com and could not find anything similar, this is not a bug that strikes many VB.NET programmers. Not entirely surprising, this only goes wrong when you append .ToString() to the nullable variable name. Nobody ever does that.

这是不是那种错误的,你可以在这个网站得到任何帮助,那就是微软需要修复的bug。

It is not the kind of bug you can get any help with at this site, it is a bug that Microsoft needs to fix.

定性错误了一下,这似乎出问题内置到调试的VB.NET具体EX pression解析器。你不能在一个C#项目瑞普这样做的原因。为什么这个过程的位数也没关系,64位调试器也显示出不好的价值观。这是一个普遍浮躁一张code,微软一直在努力退休。根本的问题是,他们已经建立了VB.NET编译器相当于到调试,使这些EX pressions能够被解析。虽然有限,该分析器不支持几乎全部的语言。副作用是,c表示调试运行$ C $可以比C程序运行$ C $不同。

Characterizing the bug a bit, this appears to go wrong in the VB.NET specific expression parser built into the debugger. The reason that you can't repro this in a C# project. And why the bitness of the process doesn't matter, the 64-bit debugger also shows bad values. This is in general a fickle piece of code that Microsoft has been working on to retire. Basic problem is that they had to build the equivalent of the VB.NET compiler into the debugger so that these expressions could be parsed. Limited though, that parser does not nearly support the entire language. Side-effect is that the code that debugger runs can be different than the code your program runs.

在code代可能为空(Of T)中的ToString()是相当棘手的,它需要一个条件装箱转换。解析器flubs它的任何此类EX pression,注意如何 MyNumber.GetHash code()产生了错误的价值。而 MyNumber.Equals(5456.0)。那种认为需要装箱转换前pressions。

The code-generation for Nullable(Of T).ToString() is fairly tricky, it requires a conditional boxing conversion. The parser flubs it for any such expression, note how MyNumber.GetHashCode() produces the wrong value as well. And MyNumber.Equals(5456.0). The kind of expressions that require that boxing conversion.

您可以在技术上报告在connect.microsoft.com这个bug,以及,但我不建议花时间。如上所述,微软一直致力于对退休这个解析器,而终于发生了。本站由罗斯林,编译服务,这是可用的任何地方。它被集成到VS2015和就知道调试器使用它。不是100%肯定,我就知道在第9天的时候VS2015被释放。也许有人安装了测试/ RC版可以用注释确认。

You can technically report this bug at connect.microsoft.com as well but I would not recommend spending the time. As noted, Microsoft has been working on retiring this parser and that finally happened. Powered by Roslyn, a compile service that's usable anywhere. It was integrated into VS2015 and as far as know the debugger uses it as well. Not 100% sure, I'll know in 9 days when VS2015 is released. Maybe somebody that has the beta/RC edition installed can confirm with a comment.

更新:确诊固定在VS2015

UPDATE: confirmed fixed on VS2015.

与此同时,直到你可以更新,解决办法是刚刚停止使用的可空变量的ToString()在你的快速/手表EX pressions。它是越野车。

Meanwhile, until you can update, the workaround is to just stop using ToString() on nullable variables in your quick/watch expressions. It is buggy.

这篇关于快速监视是不正确的显示可空属性的ToString工作()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆