1

I am creating a Windows application targeting .NET 4.5.1. It compiles and runs fine. When I hit the break-point and edit the source code, I get the message saying:

The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

I have latest Microsoft .NET Framework 4.5.1 Developer Pack installed and using VS 2013.

I have tried to manually reference the System.Runtime.dll, but then my project does not even compile, with the compiler complaining:

'System.Runtime.CompilerServices.TaskAwaiter`1' does not contain a definition for 'IsCompleted'

I can find similar error reports for ASP.NET but nothing for Windows applications. Is there something I can do to get the editing of the running source code working again?

jpou
  • 1,935
  • 2
  • 21
  • 30
  • Why would you edit the code while the application is running? – jmc Aug 06 '15 at 09:12
  • @jmc ; Don't you know the [Edit&Continue](https://msdn.microsoft.com/en-us/library/bcew296c.aspx) feature ? – JYL Aug 06 '15 at 09:16
  • to fix a bug for example @jmc – gsharp Aug 06 '15 at 09:20
  • I've seen this a few times in SO questions, the underlying cause is still very murky. Nobody lists their dependencies or posts a minimum repro so very hard to reverse-engineer. Go through the References node of the project and mention any unusual dependencies. If you use a Nuget package then be sure to name it. Also look at their Path property, anything from c:\windows\microsoft.net instead of c:\program files\reference assemblies is a problem. – Hans Passant Aug 06 '15 at 10:18
  • @HansPassant I have bare minimal repro project where I get same issue, I'll post it to the GitHub. – jpou Aug 06 '15 at 11:25
  • To reproduce this error: 1) checkout https://github.com/justas-/so-31851536; 2) add breakpoint in MainWindow.xaml.cs line 32. 3) Start app, click button 4) When VS breaks, change the line 33 to something valid 5) Clicking will cause the error to appear – jpou Aug 06 '15 at 11:37

1 Answers1

0

Try also to add a reference to:

  • System.Threading.dll
  • System.Threading.Tasks.dll
gsharp
  • 27,557
  • 22
  • 88
  • 134
  • Just found this one as well http://stackoverflow.com/questions/20324080/visual-studio-2013-net-4-5-1-edit-and-continue-64-bit-not-working?rq=1 – gsharp Aug 06 '15 at 09:29
  • Thanks, adding these references fixed it, but it still looks more like a workarround instead of actual fix. – jpou Aug 06 '15 at 11:37
  • can you migrate to visual studio 2015. the things you can do in edit & continue mode is quiet more impressive than 2013. maybe this solves also your issue (hoever I had some other side effects in 2015 that i didn't have in 2013) – gsharp Aug 06 '15 at 12:49