Failed to parse expression: class "std::_Ref_count_base" has no member "Uses" - by mloskot

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 707067 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 11/21/2011 5:00:14 PM
Access Restriction Public


In file %VSINSTALLDIR%\Common7\Packages\Debugger\Visualizers\defaultvis.natvis definition of <DisplayString> for shared_ptr refer to non-existing (private) member std::_Ref_count_base::Uses:

<DisplayString Condition="(_Rep-&gt;Uses == 1) &amp;&amp; (_Rep-&gt;_Weaks - 1 &gt; 0) &amp;&amp; (_Rep-&gt;_Weaks - 1 == 1)">shared_ptr {*_Ptr} [{_Rep-&gt;_Uses} strong ref, {_Rep-&gt;_Weaks - 1} weak ref] [{*_Rep}] </DisplayString>

This leads to parsing error of the visualizer:

Natvis: Evaluating visualizer expression (_Rep->Uses == 1) && (_Rep->_Weaks - 1 > 0) && (_Rep->_Weaks - 1 == 1) in context std::shared_ptr<int>.  Failed to parse expression: class "std::_Ref_count_base" has no member "Uses".

The fix is to replace the Uses with _Uses to correctly refer to member std::_Ref_count_base::_Uses

By the way, this may be related to
Sign in to post a comment.
Posted by Microsoft on 6/14/2012 at 5:25 PM

Thanks for reporting this bug. We've already fixed it, and the fix will be available in VC11.

(I resolved this as Fixed back in December, but while I'm virtually certain that I replied through the Connect interface, my reply doesn't seem to have gotten onto the website. So I'm trying again.)

If you have any further questions, feel free to E-mail me at .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by mloskot on 12/2/2011 at 4:34 PM
You are following correct steps which should allow you to reproduce the problem.
Perhaps you are using different build of Visual Studio 11, so you have fixed files installed.
I'm using Microsoft Visual Studio 11 Version 11.0.40825.2 PREREL

I have attached screenshot presenting the problem. However, because I've been having problems with attaching files to Microsoft Connect feedbacks, here is a copy of the screenshot:
Posted by EricLeong [Feedback Moderator] on 11/27/2011 at 9:46 PM
Thank you for reporting this issue.

Unfortunately, we are unable to reproduce the issue with the steps you provided. We tried to repro with the following steps:

1. Copy file C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Packages\Debugger\Visualizers\defaultvis.natvis
C:\Users\<YOUR USERNAME>\Documents\Visual Studio 11\Visualizers\myvisualizers.natvis
2. Open myvisualizers.natvis and replace all the exist "std::tr1::" with "std::", then save it.
3. Add the DWORD value EnableNatvisDiagnostics with value "1" under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\Debugger
4. Launch debugger with the sample listed on the connect site

In my boxes, the output window only contains a sequence of duplicate type info.

Could you please help to point out the steps misundertood or omitted?

It would be greatly appreciated if you could provide us this information as quickly as possible.

Thank you
Posted by MS-Moderator01 on 11/21/2011 at 5:43 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(