dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.06k stars 4.04k forks source link

Unable to evaluate the expression. #28359

Open CreateAndInject opened 6 years ago

CreateAndInject commented 6 years ago

Version Used: VS2017 15.7.4

Steps to Reproduce:

  1. Writes this code:
            string str = "abc";
            IntPtr ptr = Marshal.AllocHGlobal(4);
            int num = (int)ptr;
  2. View these 3 variables in the memory window

Expected Behavior: I can view all the 3 variables.

Actual Behavior: Both "str" & "num" are ok, but when I view "ptr", I get: Unable to evaluate the expression.

jcouv commented 6 years ago

Tagging @cston for expression evaluator question

cston commented 6 years ago

@CreateAndInject, I'm able to view all three variables in the Locals and Watch windows in a more recent preview build of Visual Studio, using a C# console application targeting .NET 4.6.1. How do I view variables in the a memory window?

CreateAndInject commented 6 years ago

just type the name in the memory window

pic

cston commented 6 years ago

From discussing with @plnelson, it sounds like IntPtr is not handled in the Memory window currently. Adding @caslan to re-assign this issue. Thanks.

plnelson commented 6 years ago

The debugger is failing to set DkmEvaluationResultFlags.Address for IntPtr/UIntPtr. Fix is at VilEvaluationResult/CreateInternal line 609.

vatsalyaagrawal commented 5 years ago

@tmat is this fixed? If not, please set appropriate milestone.

tmat commented 5 years ago

@plnelson ?

tmat commented 5 years ago

I can still reproduce in image But it seems this is a debugger bug, not Roslyn bug based on @plnelson's comment

r-ramesh commented 4 years ago

This should be fixed with https://devdiv.visualstudio.com/DevDiv/_git/Concord/pullrequest/194867