Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Immediate Window, "The expression cannot be evaluated...."

When I try to evaluate expression in Immediate Window at design time, I get error:

The expression cannot be evaluated while in design mode.

If I compile ASP.NET project and try to run it in debug mode I get another error:

The expression cannot be evaluated while in run mode.

Why do I get these errors? I have used Immediate Window in the past and it worked fine even in design mode.

like image 444
Tomas Avatar asked May 03 '11 09:05

Tomas


1 Answers

Assuming that you aren't missing the > operator in the Immediate Window, there could be problems if you are trying to evaluate an expression at design-time in a multi-project solution or even a web project.

According to MSDN:

If you are attempting to evaluate a function in a project that is not the startup project for the solution and you receive an error, try selecting the project in Solution Explorer and attempt the evaluation again.

Also:

You cannot use design time expression evaluation in project types that require starting up an execution environment, including Visual Studio Tools for Office projects, Web projects, Smart Device projects, and SQL projects.

like image 65
bflow1 Avatar answered Sep 21 '22 06:09

bflow1