Bug 27102 - Debugging of partial classes is broken
Summary: Debugging of partial classes is broken
Status: NEEDINFO
Alias: None
Product: Android
Classification: Xamarin
Component: Debugger ()
Version: 4.20.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-02-16 10:20 UTC by kalita
Modified: 2017-05-11 10:17 UTC (History)
5 users (show)

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


Attachments
Call stack (11.14 KB, image/png)
2015-02-16 10:21 UTC, kalita
Details
Sample Created (16.22 KB, application/octet-stream)
2015-02-17 06:07 UTC, Rajneesh Kumar
Details
iOS Partial Class Sample (14.63 KB, application/zip)
2015-08-21 13:48 UTC, Jon Davis
Details


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 for Bug 27102 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEEDINFO

Description kalita 2015-02-16 10:20:27 UTC
I am on Visual Studio 2013, Xamarin.Android 4.20.0.34.

When debugging a project containing partial classes split between two files, the debugger thinks the source code is in a wrong file.

I have class Shader which is split between 2 files: Shader.cs and Shader.OpenGL.cs. When an exception is thrown in a method defined in Shader.OpenGL.cs:90, the debugger callstack shows it is in Shader.cs:90. This line does not even exist as Shader.cs is only 83 lines long.

This also affects setting of breakpoints which is impossible in partial classes.

Attached is a screenshot of the callstack.
Comment 1 kalita 2015-02-16 10:21:45 UTC
Created attachment 9851 [details]
Call stack
Comment 2 Rajneesh Kumar 2015-02-17 06:07:25 UTC
Created attachment 9872 [details]
Sample Created

I tried to reproduce this issue but not able to reproduce. To reproduce this issue I have followed the steps and instruction provided in bug description.

Steps I followed:

1. Open attached test sample in VS.
2. Open MainActivity.cs and Set break point line 28.
3. Build and deploy it on emulator, it deploy successfully.
4. Click on button, break point will hit.
5. Click continue, observed that exception will throw.
6. Open call stack and observed that the exception is showing in correct file and at correct line.

Screencast: http://www.screencast.com/t/XXi1ivpmaB

Could you please provide us your full environment info and a small sample that reproduce this issue? also please let me know that what steps I am missing/wrong to reproduce this issue.

Also please attach VS Trace logs and application output. That would be very helpful to reproduce this issue at our end.

You can get Vs trace log from Here: help=>Zip Xamarin logs=>(Give folder name, click Save. Attach created zip file here.)

Application Output: https://gist.github.com/Rajneesh360Logica/3c9017eddb6463c6ff25
VS Trace Log: https://gist.github.com/Rajneesh360Logica/82298846175ab0f5fdb4

Environment Info:

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.50938

Installed Version: Professional

LightSwitch for Visual Studio 2013   06177-004-0446016-02381
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06177-004-0446016-02381
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06177-004-0446016-02381
Microsoft Visual Basic 2013

Visual C# 2013   06177-004-0446016-02381
Microsoft Visual C# 2013

Visual C++ 2013   06177-004-0446016-02381
Microsoft Visual C++ 2013

Visual F# 2013   06177-004-0446016-02381
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06177-004-0446016-02381
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06177-004-0446016-02381
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   12.3.50717.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Websites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.20703.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.2
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone
Build 

Microsoft Azure Mobile Services Tools   1.2
Microsoft Azure Mobile Services Tools

NuGet Package Manager   2.8.50926.663
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Office Developer Tools for Visual Studio 2013 ENU   12.0.30626
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PowerShell Tools   1.2
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   12.0.30919.1
Microsoft SQL Server Data Tools

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   3.9.318.0 (b2a3fd2)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   4.20.0.34 (49a04b966feb40dfdba49d57ba16249b66d606a6)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.6.2.0 (09ae75f83eafce1bdc3fa067f281cbdf1ca7b893)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified
Comment 3 Jon Davis 2015-08-21 13:16:25 UTC
This can be reproduced with Xamarin.iOS and Xamarin Studio 5.9.5:

From a customer:

"We’re running into an issue debugging partial class files in Xamarin Studio.  For example, if we have a class spread over 3 files— MyClass.cs, MyClass.Foo.cs, MyClass.Bar.cs—the debug info will only be correct for one of the files.  We can’t put breakpoints in the other files, and if we put a Debugger.Break() call in the other files, when it stops, the debugger always stops on the last line of the file.  Is this a known issue?"
Comment 4 Jon Davis 2015-08-21 13:48:21 UTC
Created attachment 12604 [details]
iOS Partial Class Sample
Comment 5 Rajneesh Kumar 2015-08-21 15:04:36 UTC
Hi Jon, thanks a lot for providing the test sample for this issue. I tried to reproduce this but I am not able to reproduce the behaviour as you mention in Comment 3. Please have a look on the screencast given below.

Screencast : http://www.screencast.com/t/vouNGz2Frt 

Could you please provide us some steps to check this issue that would be very helpful to reproduce this issue at our end.

Thanks..!

Environment Info:

=== Xamarin Studio ===

Version 5.9.5 (build 9)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
	Mono 4.0.3 ((detached/d6946b4)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400030020

=== Xamarin.Android ===

Version: 5.1.5.3 (Enterprise Edition)
Android SDK: /Users/MM/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		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)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.iOS ===

Version: 8.10.4.51 (Enterprise Edition)
Hash: 838ae98
Branch: master
Build date: 2015-08-10 13:03:59-0400

=== Xamarin.Mac ===

Version: 2.0.2.126 (Enterprise Edition)

=== Build Information ===

Release ID: 509050009
Git revision: b99cb19a1d3b15d8980c4616f13f837457e5b292
Build date: 2015-07-28 02:01:44-04
Xamarin addins: d53d6eceb828422f3d4aff8547f2f6bab6c9ea58

=== Operating System ===

Mac OS X 10.9.5
Darwin MacMini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 6 Jon Davis 2015-08-23 14:31:35 UTC
Hi Rasjneesh,

Here is the screencast reproducing the errors:
http://www.screencast.com/t/AGWR2cBgUZt5

Also, I noticed our versions are different. I'm using Xcode 6.4 and OSX 10.10


=== Xamarin Studio ===

Version 5.9.5 (build 10)
Installation UUID: daf1083a-ee81-47d5-9573-ec0742a4cbbc
Runtime:
	Mono 4.0.3 ((detached/d6946b4)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400030020

=== Apple Developer Tools ===

Xcode 6.4 (7720)
Build 6E35b

=== Xamarin.iOS ===

Version: 8.10.4.46 (Enterprise Edition)
Hash: 2c66d2f
Branch: master
Build date: 2015-08-04 13:52:25-0400

=== Xamarin.Android ===

Version: 5.1.5.3 (Enterprise Edition)
Android SDK: /Users/jond/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		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)
		5.0   (API level 21)
Java SDK: /usr
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.0.2.111 (Enterprise Edition)

=== Build Information ===

Release ID: 509050010
Git revision: 48d16bc4f12ce3938964fc7c3d72fdc6887ad4ad
Build date: 2015-08-18 16:55:24-04
Xamarin addins: c2d51b360ad9f59e689046d47030df27de28f94a

=== Operating System ===

Mac OS X 10.10.4
Darwin jond-mac-1891.local 14.4.0 Darwin Kernel Version 14.4.0
    Thu May 28 11:35:04 PDT 2015
    root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
Comment 7 Ben 2015-12-02 10:54:44 UTC
I am also experiencing this issue, but with Android rather than iOS. Many partials have debugged just fine, but suddenly, I am reliably experiencing this issue on one particular partial.

The fact it's happening on both iOS and Android would suggest it's something fundemental to the debugging process, rather than platform specific. 

It is quite infuriating!