开发者

Problem with Visual Studio 2010 DataTips in a mixed C++/CLI assembly

I've recently switched to using Visual Studio 2010. I've got a problem where the DataTips (debugger tooltips) for STL types aren't loading correctly.

For example, in the following code:

int test( const std::string& inString )
{
    std::string aString( "Hello, World!" );

    return aString.compare( inString );
}

I don't get the expected tooltip ([+] aString| "Hello, World!") but instead get something like [+] aString | {npos=4294967295}.

Ex.

Problem with Visual Studio 2010 DataTips in a mixed C++/CLI assembly

(source: bordeaugrove.com)

I've tested things a little and I've found that in my native (unmanaged) Projects, I don't get the problem. The Project where I'm getting this problem is a mixed native and C++/CLI DLL.

I'm awa开发者_StackOverflow社区re the Intellisense isn't supported for C++/CLI in Visual Studio 2010, but as far as I know, this should be working in the debugger.

I'm wondering if I've just got a corrupt installation or the incorrect settings somewhere.

Anybody got any suggestions?


According to the first couple of comments here, C++/CLI isn't supported by VS2010 intellisense. The second comment is by a member of the MS team and he offers a rationalization for this.


According to "std-string-content-not-shown-in-the-debugger" this is caused by mixing libraries built with VS 2005 and VS 2010. However there may be multiple causes.

One potential workaround is to add the following to your watch window, where message is a std::string

message._Bx._Ptr // use when the string is longer than 16 characters
message._Bx._Buf // use when the string is less than or equal to 16 characters

These variables can be found either by browsing the STL source, or by using the following in the watch window to expand the object, where message is a std::string it allows browsing the objects raw format, ignoring any data type views customizations:

message,!

A more in depth explanation of this and other watch window format specifiers can be found at Format Specifiers in C++.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜