- article
Applies to: visual study
Visual Studio for Mac
visual study code
The Visual Studio debugger includes an expression evaluator when you're insidefast guarddialog box,I'm watchingwindows ordirectwindow. The expression evaluator also worksbreaking pointwindows and many other places in the debugger.
The following sections describe expression evaluation restrictions for languages supported by Visual Studio.
F# expressions are not supported
The F# expression is not recognized. If you are debugging F# code, you must convert the expression to C# syntax before entering the expression into a debug window or dialog. When translating expressions from F# to C#, it is important to remember that C# uses==
operator to check for equality, while F# uses a unique=
.
C++ expression
For information about using contextual operators with expressions in C++, seeEnvironment Operators (C++).
Expressions are not supported in C++
Constructors, destructors and conversions
You cannot explicitly or implicitly call an object's constructor or destructor. For example, the following expression explicitly calls the constructor and results in an error message:
my_date (2, 3, 1985)
The conversion function cannot be called if the target of the conversion is a class. This conversion includes the construction of the item. For example ifminimum score
is an examplegrade C
, which defines the conversion function operatoralmost point
, the following expression results in an error:
(fixed point) my rating
You cannot call new or delete operators. For example, the following expressions are not supported:
date (2.3.1985)
preprocessor macros
The debugger does not support preprocessor macros. For example, if a constantvalue
declared as:#define value 3
, you cannot usevalue
indeI'm watchingwindow. To avoid this limitation, you should replace#definition
Use numbers and functions whenever possible.
Using namespace declarations
you cannot useuse namespace
announcement. To access a type name or variable outside the current namespace, the fully qualified name must be used.
anonymous namespace
Anonymous namespaces are not supported. Unable to add if you have the following codetry it
for the protective window:
namespace mars { namespace { int test = 0; }}int main(){ // Adding a clock to a test has no effect. March::test++; return 0; }
Use debug properties to maintain state
Debug properties give you a way to call certain C/C++ functions in expressions without changing the state of your application.
Debug properties:
Guaranteed Safety: Running the debugger will not inherently destroy the debugging process.
allowed under all conditions, even when side effects and functional evaluation are not allowed.
It works in scenarios where normal function calls are not possible, such as debugging minidumps.
Debugging properties can also make evaluating expressions more convenient. E.g,
strncmp (str, "asd")
Write in breakpoint mode fromstr[0] == 'a' && str[1] == 's' && str[2] == 'd'
)
area | internal function |
---|---|
string length | strlen, wcslen,strnlen, wcsnlen |
strict comparison | strcmp, wcscmp,strip, wcsicmp,_stricmp、_strcmpi、_wcsicmp、_wcscmpi,strncmp, wcsncmp,strnicmp, wcsnicmp,_strnicmp, _wcsnicmp |
string search | strchr, wcschr,memchr, wmemchr,strstr, wcssstr |
Win32 | decoding factor,decoding indicator,get the latest error,gain value |
windows 8 | RoInspectCapturedStackBackTrace,Windows compares string words,Windows are of string length,WindowsGetStringRawBuffer These features require that the debugging process run on Windows 8. Debugging a dump file generated by a Windows 8 device also requires Visual Studio running on Windows 8. However, if you are debugging remotely on a device Windows 8, Visual The Studio engine runs Windows 7. |
Different kinds | __log2- Returns the base 2 logarithm of the specified integer, rounded to the nearest smaller integer. __findNonNull- Searches the index array and returns the index of the first non-zero element. Decode HString- Helper functions for formatting HSTRING values. Pop the HSTRING value off the stack, push bytes of the StringInfo structure that EE can use to tell where the string is. This is for internal EE use only. cannot be called directly by the user. Decode WinRTRestrictedException- Decode limited WinRT exceptions for limited descriptors. dynamic casting- Implementer dynamic_cast. dynamic member posting- Helper function to dynamically get class member values Get the length of the context block- Helper function to get the length of the context block in characters. for $env. Stdext_HashMap_Int_OperatorBracket_idx- operator[] for stdext::hash_map. Assume the default hash function key is "int". return value. The native [] operator only supports retrieving existing elements from a hash table - it does not support inserting new elements into the table, as this can involve unnecessary complications such as memory allocation. However, the[] operator can be used to change the value associated with an existing key in the array. Std_UorderedMap_Int_OperatorBracket_idx- std::unordered_map works the same as stdext::hash_map except for the hash function. ConcurrencyArray_OperatorBracket_idx// both ::array<>::operator[index<>] and operator(index<>) ConcurrencyArray_OperatorBracket_int// samtidig ::array<>::operator(int, int, ...) ConcurrencyArray_OperatorBracket_tidx// simultaneously :: array<>::operator[tiled_index<>] and operator(tiled_index<>) ConcurrencyArrayView_OperatorBracket_idx// both ::array_view<>::operator[index<>] and operator(index<>) ConcurrencyArrayView_OperatorBracket_int// samtidig ::array_view<>::operator(int, int, ...) ConcurrencyArrayView_OperatorBracket_tidx// samtidig ::array_view<>::operator[tiled_index<>] og operator(tiled_index<>) traversal_initialization tree- Start a new tree traversal. traversal_next tree- Retrieve a node from a pending tree traversal. traversal_skip tree- Skipping nodes in a pending tree traversal. |
C++/CLI - unsupported expression
Broadcasts that include pointers or custom broadcasts are not supported.
Comparing and assigning objects is not supported.
Overloaded operators and overloaded functions are not supported.
Encapsulation and decoding are not supported.
Size
The operator is not supported.
C# - Unsupported expression
dynamic object
You can use statically typed dynamic variables in debug expressions. when the object implementsIDynamicMetaObjectProvider dynamic meta object providerAfter evaluation in the watch window, a dynamic view node is added. Dynamic view nodes display object members but do not allow editing of member values.
The following features on dynamic objects are not supported:
compound operator
+=
,-=
,%=
,/=
, and*=
Many versions, including numerical models and parameter types
Method calls with more than two parameters
Property getters with more than two parameters
property setter with parameters
is assigned to the indexer
boolean operator
&&
and||
anonymous method
Creating new anonymous methods is not supported.
Visual Basic - Unsupported expression
dynamic object
You can use statically typed dynamic variables in debug expressions. when the object implementsIDynamicMetaObjectProvider dynamic meta object providerAfter evaluation in the watch window, a dynamic view node is added. Dynamic view nodes display object members but do not allow editing of member values.
The following features on dynamic objects are not supported:
compound operator
+=
,-=
,%=
,/=
, and*=
Many versions, including numerical models and parameter types
Method calls with more than two parameters
Property getters with more than two parameters
property setter with parameters
is assigned to the indexer
boolean operator
&&
and||
local constant
Local constants are not supported.
input alias
Entering aliases is not supported.
variable declaration
You cannot declare explicit new variables in the debugger window. However, you can assign new implicit variables insidedirectwindow. These implicit variables are covered only by the debugger session and cannot be accessed outside the debugger. For example stateØ = 5
implicitly creates a new variableOh
and assign the value 5 to it. Such implicit variables are of typePurposeUnless the debugger can infer the type.
unsupported keyword
address
end
error
Exit
I am going
When something goes wrong
restore
RETURN
Election/Case
I am waiting
sync lock
Shot
try/catch/finally
and
Names or module level keywords like
finally below
themeasurement unit
.
See also
- Format specifications in C++
- Environment Operators (C++)
- Format Specifiers in C#
- dummy variable