Bug 46282 - Cannot access a disposed object..
Summary: Cannot access a disposed object..
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 4.2.0 (C8)
Hardware: PC Windows
: --- normal
Target Milestone: 4.2.1 (C8SR1)
Assignee: mag@xamarin.com
Depends on:
Reported: 2016-11-02 05:18 UTC by James Montemagno [MSFT]
Modified: 2016-11-04 12:40 UTC (History)
9 users (show)

Is this bug a regression?: Yes
Last known good build: Xamarin.VisualStudio_4.2.1.15

Connection error (9.76 KB, image/png)
2016-11-02 05:18 UTC, James Montemagno [MSFT]

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description James Montemagno [MSFT] 2016-11-02 05:18:08 UTC
Created attachment 18297 [details]
Connection error

In the latest version I continue to keep getting "Cannot access a disposed object. Object name: "BuildConnection"" Sometimes VS crashes and then I have to restart it to fix it.
Comment 2 mag@xamarin.com 2016-11-02 14:20:25 UTC
It would be good to have more details and better information on this error.


i - When does it happens? (on every build attempt, sometimes, etc)
ii - Are you getting full connected to XMA (green XMA icon on the toolbar)
iii - Please start VS in log mode, so we can get verbose logs on both Win and Mac (devenv.exe /log)
iv - After reproducing the error with VS in log mode, please attach the VS logs as well as Mac logs of the corresponding VS session
Comment 3 Oleg Demchenko 2016-11-02 16:46:05 UTC
Changing status to NEEDINFO based on previous comment
Comment 4 Oleg Demchenko 2016-11-02 17:03:18 UTC
Coarse reproduction steps:

> just debug ios apps usually with remote ios simulator from windows
> And about after a few runs it will just happen
> Has never happened before
> Ran into it about 10 times yesterday

Plus info from @Alan:

> that error happens when xvs disposes it's `BuildConnection` object  
> https://github.com/xamarin/XamarinVS/blob/master/src/MSBuild/Xamarin.VisualStudio.Build/BuildConnection.cs#L213
Comment 5 mag@xamarin.com 2016-11-02 17:38:50 UTC
ObjectDisposedException is thrown when MSBuild tries to use BuildConnection, because the connection has been finished for some reason.

That's why MSbuild output, VS and XMA logs would be useful. I need to figure out if the XMA connection is being closed (error, remote disconnection, etc). Also If it's being closed on VS and MSBuild, only on MSBuild, etc.

Only with the above information I can do basically nothing, because I'm not being able to reproduce it.

I will play around a little bit to try getting this behaviour.

But if you can get me the logs when this happens, it could be more useful.
Comment 11 xamarin-release-manager 2016-11-03 03:32:46 UTC
Fixed in version (cycle8-bug46282)

Author: victorgarciaaprea
Commit: 5efdbf19242e8d29cc4cda7e2c1bfd86bd0b5993 (xamarin/XamarinVS)
Comment 12 Saurabh 2016-11-03 06:27:00 UTC
I can also reproduced this Issue using comment#9. This is the build output for the same: https://gist.github.com/sachins360/f9b386b00e538e6d4daca9705201a640
XVS, XI VS 2015

I checked the Issue with latest XVS, Now this is working fine.
XVS, XI VS 2015

IDE Log: https://gist.github.com/saurabh360/9d857a8b7b3f2aa0dce460898eb1a1bf
Comment 13 Saurabh 2016-11-03 07:37:34 UTC
I got fixed build from 	'xvs-win-cycle8-bug46282'lane but not seeing fixed build from 'xvs-win-cycle8' lane.

Please confirm me if fixed build will be merged into 'xvs-win-cycle8' for release?
Comment 14 xamarin-release-manager 2016-11-03 12:50:09 UTC
Fixed in version (cycle8)

Author: victorgarciaaprea
Commit: fb22cf9e8c2f80d92420910b7fd046045f7d2885 (xamarin/XamarinVS)
Comment 15 xamarin-release-manager 2016-11-03 15:25:06 UTC
Fixed in version (cycle8)

Author: victorgarciaaprea
Commit: 124903bed49c2784c9951236129dc61cac1e786e (xamarin/XamarinVS)
Comment 16 Saurabh 2016-11-04 12:40:13 UTC
I have checked this Issue with latest C8SR1 build XVS This is working fine with this build.

Microsoft Visual Studio Enterprise 2015
Version 14.0.25422.01 Update 3
Microsoft .NET Framework
Version 4.6.01055

Installed Version: Enterprise

Xamarin (124903b)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Inspector Support (76a53d3)
Adds support for inspecting Xamarin and WPF apps.

Xamarin.Android (301f2df)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS (44931ae)
Visual Studio extension to enable development for Xamarin.iOS.