Bug 18914

Summary: Unhandled exception is raised on attempt to watch local var after async/await call
Product: [Mono] Runtime Reporter: Ievgen <ievgen.tiutiunnyk>
Component: DebuggerAssignee: Zoltan Varga <vargaz>
Status: RESOLVED FIXED    
Severity: normal CC: mohitk, mono-bugs+monodevelop, mono-bugs+mono, mono-bugs+runtime, udhams
Priority: Normal    
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: Stack Trace
The solution with a code to reproduce the bug

Description Ievgen 2014-04-09 19:54:33 UTC
I just try to see the variable value that has the result of async call during debugging session. I use async/await approach. After execution is stopped at my breakpoint when I mouse over the var in the code the exception is raised. It's also raised when I go to Watch Locals window.

I am debuggin iOS application.

Stack-trace is attached.
Comment 1 Ievgen 2014-04-09 19:55:03 UTC
Created attachment 6544 [details]
Stack Trace
Comment 2 Udham Singh 2014-04-11 07:16:43 UTC
I have checked this issue but not able to reproduce this. To reproduce this issue I have created a "Test Project" and implemented the code which include the async/await. Please refer the screencast : http://screencast.com/t/Ff07euqKso

Environment Info :

Mac OS X 10.9.2
Xamarin Studio : 4.2.3 (build 60)
Xamarin.iOS : 7.0.7.2 (Trial Edition)
Xamarin.Android : 4.12.1 (Starter Edition)

Please let me know if i am missing any thing or could you please provide the Test project in which you are facing the issue so that i can reproduce this at my end.
Comment 3 Ievgen 2014-04-12 17:14:40 UTC
I made a demo solution to demonstrate the bug. I have other bugs to file into bugzilla so the solution contains several issues to reproduce at once. 

In order to compile it, the NuGet 2.8.1 (means MrWard Version 0.9) Add-In should be installed into Xamarin.Studio. It should be taken from this URL:

http://mrward.github.com/monodevelop-nuget-addin-repository/4.0-test/main.mrep

as described here: 

http://community.sharpdevelop.net/blogs/mattward/archive/2013/01/07/MonoDevelopNuGetAddin.aspx

Therefore before building the solution all NuGet packages should be resotored for the main and libarary projects.

So to reproduce the bug, put a breakpoint into MyRestCallClass class in TempPCL library at line 59. Run the app in debug mode with iPhone Simulator. 

When app stops at the break point mouse over result.Ip property. The exception will be raised and the debug session will be crashed.

Regards.
Comment 4 Ievgen 2014-04-12 17:15:20 UTC
Created attachment 6561 [details]
The solution with a code to reproduce the bug
Comment 5 Udham Singh 2014-04-14 05:55:33 UTC
I have checked this issue with sample project attached in comment 4 and able to reproduce this. To reproduce this issue I have followed the suggestions provided into comment 3 and noticed the same behavior mentioned into bug description and comment 1.

Screencast : http://screencast.com/t/xdVguxFI3

Application Output Log : https://gist.github.com/anonymous/ee408df4a8c04a23f1b4
Ide Log : https://gist.github.com/anonymous/e9f1d6667426f880ab49
Error Log : https://gist.github.com/anonymous/1585087d796c350723cf
Comment 6 Udham Singh 2014-04-14 05:59:26 UTC
Environment info : 

Mac OS X 10.9.2
Xamarin Studio : 4.2.3 (build 60)
Xamarin.iOS : 7.2.0.2 (Trial Edition)
Xamarin.Android : 4.12.1 (Starter Edition)
Comment 7 Jeffrey Stedfast 2014-04-14 16:34:28 UTC
This appears to be crashing in the runtime
Comment 8 Zoltan Varga 2014-04-19 03:05:03 UTC
This happens because a struct is referencing itself through an interface field, so the runtime goes into infinite recursion when trying to send it to the debugger.
Comment 9 Zoltan Varga 2014-05-13 12:32:30 UTC
Fixed in mono master 5f54be7af1e4f21c47c6af232655287538de801d.
Comment 10 Mohit Kheterpal 2014-06-03 10:27:04 UTC
I have checked this issue and this issue does not exist as shown in screencast : http://screencast.com/t/qYJqQT2ogFu.

Hence closing this issue.

Environment info:
=== Xamarin Studio ===

Version 5.1 (build 327)
Installation UUID: 449f40dd-b3f1-4028-9a6b-cca0d1a2307d
Runtime:
	Mono 3.4.0 ((no/c3fc3ba)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 304000204

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.iOS ===

Version: 7.2.99.420 (Enterprise Edition)
Hash: 5aa4bec
Branch: 
Build date: 2014-06-02 00:04:26-0400

=== Xamarin.Android ===

Version: 4.14.0 (Enterprise Edition)
Android SDK: /Users/360logicaxamarinmacmini/Desktop/android-sdk-macosx_Róbert_à
	Supported Android versions:
		1.6   (API level 4)
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Xamarin.Mac ===

Xamarin.Mac: 1.8.0.7

=== Build Information ===

Release ID: 501000327
Git revision: 9a4bf62f59ec39169e4e9b61c3816a03c8ac961f
Build date: 2014-06-03 06:01:06-04
Xamarin addins: b68a34ef2fc4c46b045dc38e26fb199bfe1b201d

=== Operating System ===

Mac OS X 10.8.4
Darwin 360Logicas-Mac-mini.local 12.4.0 Darwin Kernel Version 12.4.0
    Sun Mar 10 18:01:10 PDT 2013
    root:xnu-2050.24.6~1/RELEASE_X86_64 x86_64