Bug 56953 - The requested operation cannot be completed because the object has been garbage collected.
Summary: The requested operation cannot be completed because the object has been garba...
Status: CONFIRMED
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger (show other bugs)
Version: master
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2017-05-30 02:41 UTC by smorsi27
Modified: 2017-09-11 15:34 UTC (History)
6 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Small example project of the issue. (10.79 KB, application/zip)
2017-07-06 09:35 UTC, Manuel de la Peña
Details
Image showing the issue. (25.03 KB, image/png)
2017-07-06 09:36 UTC, Manuel de la Peña
Details

Description smorsi27 2017-05-30 02:41:18 UTC
Everytime I debug and I try to check the contents of a collection for example either through a watch window or by hovering over the variable and looking at the values at runtime, I keep running into this issue: 

The requested operation cannot be completed because the object has been garbage collected after I look at the collection the first time. 

I'm running Xamarin Studio on MAC OSX Sierra with the latest Xamarin.iOS version.
Comment 1 Manuel de la Peña 2017-05-31 16:42:47 UTC
Hello, can you please provide the full version information. Easiest way to get exact version information:

 - On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.
 - On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.
 Then copy/paste the version information (you can use the "Copy Information" button).

Once we have that info we will look at the exact version and will try to get more information about the issue.

Thanks in advance.
Comment 2 smorsi27 2017-05-31 21:20:24 UTC
=== Xamarin Studio Community ===

Version 6.3 (build 864)
Runtime:
	Mono 5.0.1.1 (2017-02/5077205) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 500010001

=== NuGet ===

Version: 3.5.0.0

=== Xamarin.Profiler ===

Version: 1.5.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.3.2 (12175)
Build 8E2002

=== Xamarin.iOS ===

Version: 10.10.0.36 (Xamarin Studio Community)
Hash: d2270eec
Branch: d15-2
Build date: 2017-05-22 16:30:53-0400

=== Xamarin.Android ===

Version: 7.3.1.2 (Xamarin Studio Community)
Android SDK: /Users/~/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		6.0 (API level 23)

SDK Tools Version: 25.1.2
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin.Mac ===

Version: 3.4.0.36 (Xamarin Studio Community)

=== Xamarin Inspector ===

Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT

=== Build Information ===

Release ID: 603000864
Git revision: 6c2f6737278ccc3e81e12276d49c0d92f975f189
Build date: 2017-04-24 11:26:01-04
Xamarin addins: d8d46e577d8507c35260ce9d73df3c33415bb214
Build lane: monodevelop-lion-d15-1

=== Operating System ===

Mac OS X 10.12.5
Darwin 32554-MBPR 16.6.0 Darwin Kernel Version 16.6.0
    Fri Apr 14 16:21:16 PDT 2017
    root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64
Comment 3 smorsi27 2017-06-05 16:30:34 UTC
What about looking into this one? Thanks! It's still marked as NEEDINFO.
Comment 4 Manuel de la Peña 2017-06-06 15:54:19 UTC
Reopening and taking a look at a reproducible test.
Comment 5 Manuel de la Peña 2017-06-07 08:56:13 UTC
Bug confirmed and reassigning to the XS team.
Comment 6 Lluis Sanchez 2017-06-07 09:02:11 UTC
What is the reproducible test?
Comment 7 Manuel de la Peña 2017-07-06 09:35:48 UTC
Created attachment 23323 [details]
Small example project of the issue.

You have to add a break point in the Console.WriteLine and wait a reasonable amount of time for the objects to be collected.
Comment 8 Manuel de la Peña 2017-07-06 09:36:37 UTC
Created attachment 23324 [details]
Image showing the issue.

This was achieved with the following version:

=== Visual Studio Enterprise 2017 for Mac (Preview) ===

Version Preview - Internal Dogfood (7.1 build 1274)
Installation UUID: 8d12e55e-3489-463f-ac52-8cb4573c5a81
Runtime:
	Mono 5.5.0.19 (master/a46742d) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 505000019

=== NuGet ===

Version: 4.3.0.2418

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Version: 1.0.0
SDK: /usr/local/share/dotnet/sdk/1.0.0-preview2-003121/Sdks
SDK Version: 1.0.0-preview2-003121
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.5.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.5.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.3 (12169)
Build 8E162

=== Xamarin.iOS ===

Version: 10.10.0.36 (Visual Studio Enterprise)
Hash: d2270eec
Branch: d15-2
Build date: 2017-05-22 16:30:53-0400

=== Xamarin.Android ===

Version: 7.3.1.2 (Visual Studio Enterprise)
Android SDK: /Users/mandel/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
		6.0   (API level 23)
		7.1   (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.4
SDK Build Tools Version: 25.0.1

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin.Mac ===

Version: 3.4.0.36 (Visual Studio Enterprise)

=== Xamarin Inspector ===

Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT

=== Build Information ===

Release ID: 701001274
Git revision: a86cd61d6bc9370a20f3ae2c9a88afc5bfbb25c0
Build date: 2017-07-05 18:33:19-04
Xamarin addins: 277532f43f135c85972a0b62c5fcd11965f675fe
Build lane: monodevelop-lion-dogfood-vNext

=== Operating System ===

Mac OS X 10.12.5
Darwin 16.6.0 Darwin Kernel Version 16.6.0
    Fri Apr 14 16:21:16 PDT 2017
    root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64
Comment 9 David Karlaš 2017-07-12 17:47:03 UTC
I was able to reproduce this using this steps:
1) Download attached project
2) Place breakpoint on line 36 in ViewController.cs("Console.WriteLine("Wait here.");")
3) Start debugging
4) In Locals pad expand `collection` variable
5) Inside iPhone Simulator simulate Home button and open application again(I assume this triggers GC)
6) Try expanding child of `collection` and runtime will respond with ERR_INVALID_OBJECT.

Note You need to log in before you can comment on or make changes to this bug.