47

Environment: Visual Studio 2017 version 15.5.2

Error:

Evaluating the function 'function' ("Windows.Controls...ToString" in my case) timed out and needed to be aborted in an unsafe way.

Answers say this commonly occurs when

Options > Debugging > General > enable property evaluation > is enabled.

I disabled this. Problem still happens. Microsoft presents a few options to solve this including

  • Prevent the debugger from calling the getter property or ToString method (In my case this is 3rd party code)
  • Have the target code ask the debugger to abort the evaluation (I don't know what this means. It strikes me as "just ignore it")
P.Brian.Mackey
  • 43,228
  • 68
  • 238
  • 348

2 Answers2

79

I found this was related to ReSharper. Unchecking Debugger Integration from the ReSharper options solved the issue for me:

VS2017 > ReSharper > Options > Products & Features > Uncheck Debugger Integration

enter image description here

Jeff Widmer
  • 4,746
  • 6
  • 37
  • 51
  • 1
    Thank you - this solved a lot of frustration my end (I'm on VS Enterprise 2017 15.7.4) – Ilessa Jul 09 '18 at 13:10
  • 1
    VS Professional 15.7.4 had this issue debugging an Excel AddIn, this solved it, thanks. – Peroxy Jan 29 '19 at 12:25
  • 1
    I persevered with Resharper even after it slowed my VS down to a crawl. I put up with the over-the-top nagging & hints & such. This is the last straw, I'm removing it. Begone Resharper & good riddance – ShrapNull Feb 28 '19 at 22:21
  • This solved the issue for me on VS2019 with Resharper 2019.1.3 – Cotta Aug 01 '19 at 07:09
8

This popped up for me in Visual Studio 2017. Version 15.5.2. I stopped the error with an option in the top menu:

Debug > Options > "Use Managed Compatibility Mode"

This is not ideal. From the docs "Use Managed Compatability Mode":

Replaces the default debugging engine with a legacy version to enable these scenarios:

You are using a .NET Framework language other than C#, VB, or F# that provides its own Expression Evaluator (this includes C++/CLI).

You want to enable Edit and Continue for C++ projects while mixed mode debugging.

Note that choosing Managed Compatibility mode disables some features that are implemented only in the default debugging engine.

I hope to see a better fix soon. As of 2/20/2018 there is a similar/same open issue in the Microsoft Developer Community.

UPDATE

This bug is listed as closed/fixed as of 5/22/2020.

P.Brian.Mackey
  • 43,228
  • 68
  • 238
  • 348
  • 3
    Still an issue on VS 15.7.3, and this tip still works, so thanks! – Stan Jun 08 '18 at 20:30
  • This works for me, also, this issue should be fixed in VS 15.8 Preview 4 according to comments here: https://developercommunity.visualstudio.com/content/problem/233452/evaluating-the-function-timed-out-and-needed-to-be-3.html – Hyperdingo Jul 25 '18 at 08:42
  • Saw this in VS 2019 (16.4.5). This fixed it. – Textcape Mar 12 '20 at 21:10