Visual Studio 2015 Convert.ToDouble gives an error while trying to view lambda expression

I give VS 2015 a try, and, as everyone knows, one of the coolest features is the ability to watch lambda expressions in the watch window.

I created a console application to test this, and here is the code for this.

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WatchLambdaExpressions { class Program { static void Main(string[] args) { var books = new List<Book>() {new Book() { Author="JKRowling", Rating="5", Title="Harry Potter" }, new Book() { Author="Baroness Orczy", Rating = "4.8", Title="Scarlet Pimpernell" }, new Book() { Author = "JRRTolkein", Rating="5", Title="Lord of the Rings" }, new Book() { Author="Alexander Dumas", Rating="4.9", Title="Count of Monte Cristo" }, new Book() { Author="Robert Ludlum", Title = "Bourne Identity", Rating = "4.6" } }; var selectedBooks = books.Where(b => Convert.ToDouble(b.Rating) >= 4.8); } } public class Book { public string Title { get; set; } public string Author { get; set; } public string Rating { get; set; } } } 

I run the program in debug mode and place a breakpoint at the exit point from the Main method.

Ok, now I go to the clock window and write:

 books.Where(b => Convert.ToDouble(b.Rating) >= 4.8) 

I expected the above to evaluate and filter out and show me a list of books where the rating is> = 4.8, but it shows

Error: debugger cannot evaluate this expression

Do you have any idea why?

I can follow other lambda expressions.

This works great:

 books.Where(b => b.Title.Contains("Harry")) 
+4
source share
1 answer

Visual Studio 2015 Update 1-hour update. Therefore, I consider this resolved. Thanks

+2
source

All Articles