- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
I have come across a weird result when I examine the contents of an object using the watch functionality in MS Visual studio. I get this kind of behavior:
Name Value Type
Object%SubClass%Variable1 (1:3) REAL(8)
Object%SubClass%Variable2 1.5 REAL(8)
Object%SubClass%Variable3 96 INTEGER(4)
Object%SubClass% Syntax Error
The last line in the watch have a value of "Syntax Error". I am not sure if this means I have made a mistake, or that MS Visual Studio is having difficulty distinguishing methods from variables. The project compiles and runs, but I am worried I have made a mistake I should fix before continuing.
Has anyone else had experience of this issue?
Best wishes,
Magnus Anderson
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There had been some reports of debugger issues when a UDT has no data members. iow only contained procedures.
Do you have a member variable in the Simulation type? (as opposed to only functions?)
If so, is there a reference to one of these variables in scope in your code edit session?
If so, can you Quick Watch one of these?
If so, can you Quick Watch only the "Simulation" part of that statement?
else
Add a reference to any member variable, then try the Quick Watch as above,
endif
And... If it be the case that you have no member variables in your Simulation, add one.
Jim Dempsey
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This error means that the form of identifier you asked to watch is invalid. In this case, it's the trailing %. DId you type that yourself, or did you right click on something and select Add Watch?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your reply! I right clicked on the parent object and added a watch.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Would you please share a screenshot of where you're clicking to add the watch? I tried making my own example but could not reproduce the issue. Also. please let us know which version of the compiler you have installed (Help>About in Visual Studio will tell you.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am right clicking and then using the "Add Watch" option
The system Info is below:
Microsoft Visual Studio Professional 2019
Version 16.11.30
VisualStudio.16.Release/16.11.30+34031.81
Microsoft .NET Framework
Version 4.8.09032
Installed Version: Professional
Visual C++ 2019 00435-60000-00000-AA380
Microsoft Visual C++ 2019
ASP.NET and Web Tools 2019 16.11.116.46506
ASP.NET and Web Tools 2019
Azure App Service Tools v3.0.0 16.11.116.46506
Azure App Service Tools v3.0.0
C# Tools 3.11.0-4.22108.8+d9bef045c4362fbcab27ef35daec4e95c8ff47e1
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Intel Libraries for oneAPI 2023.1
Intel Libraries for oneAPI 2023.1, Copyright © 2019-2023 Intel Corporation. All rights reserved.
Intel® C++ Compiler 2023.1
Intel® C++ Compiler 2023.1, Copyright © 2002-2023 Intel Corporation. All rights reserved.
Intel® C++ Compiler Classic 2021.9
Intel® C++ Compiler Classic 2021.9, Copyright © 2002-2023 Intel Corporation. All rights reserved.
Intel® Fortran Compiler 2023.1
Intel® Fortran Compiler 2023.1, Copyright © 2002-2023 Intel Corporation. All rights reserved.
Intel® oneAPI DPC++ Compiler 2023.1
Intel® oneAPI DPC++ Compiler 2023.1, Copyright © 2019-2023 Intel Corporation. All rights reserved.
Intel® oneAPI Menu & Samples 10.10.392.9731
Intel® oneAPI Visual Studio Menu & Samples Extension
IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info
Linux Core Dump Debugging 1.0.9.34031
Enables debugging of Linux core dumps.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
NuGet Package Manager 5.11.4
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.
Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.
TypeScript Tools 16.0.30526.2002
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 3.11.0-4.22108.8+d9bef045c4362fbcab27ef35daec4e95c8ff47e1
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual C++ for Linux Development 1.0.9.34031
Visual C++ for Linux Development
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Tools for CMake 1.0
Visual Studio Tools for CMake
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the Watch Window, should the new watch item be added with a trailing %, you can double click on that item in the Watch Window, then edit the name (strike the trailing %).
Next time, to avoid this issue, You can possibly select the parent node (click to left of node, drag across node name and stop before %, then right click and add watch).
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Jim, I will try this now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I wanted to see the source line and the position of the cursor when you did this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, it isn't. I want to see the source line where you are clicking to add the watch, so that I can see the whole identifier. Are you selecting part of the line, or just right clicking on the variable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am hovering the mouse cursor over the variable name and then right clicking
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There had been some reports of debugger issues when a UDT has no data members. iow only contained procedures.
Do you have a member variable in the Simulation type? (as opposed to only functions?)
If so, is there a reference to one of these variables in scope in your code edit session?
If so, can you Quick Watch one of these?
If so, can you Quick Watch only the "Simulation" part of that statement?
else
Add a reference to any member variable, then try the Quick Watch as above,
endif
And... If it be the case that you have no member variables in your Simulation, add one.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK, though this is quite different from your original description - a usual problem when one posts "looks like" code or snippets rather than the actual code. That said, I still can't reproduce the behavior. At this point I'd ask for a complete, small if possible, reproducible example.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
My attempt to make a similar code and recreate the error message was not successful. I do not see the weird "syntax error" as an entry in the object watch list. I most likely made a mistake. I have quite a deep nested object structure and I will check each level is behaving and follow Jim Dempsey's advice and double check that the all objects have members.
Thank you for your help with this.
Best wishes,
Mags

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page