Bug 28660 - [Visual Studio] Setting breakpoint throws exception message
Summary: [Visual Studio] Setting breakpoint throws exception message
Status: RESOLVED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Debugger ()
Version: 3.9
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Joaquin Jares
URL:
Depends on:
Blocks:
 
Reported: 2015-04-01 15:12 UTC by Dominic N [MSFT]
Modified: 2018-03-14 18:12 UTC (History)
9 users (show)

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

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:
Status:
RESOLVED FIXED

Description Dominic N [MSFT] 2015-04-01 15:12:47 UTC
## Overview

We have a report of a trial user hitting an odd error in Visual Studio where setting a breakpoint throws the following exception:

System.ArgumentException: Cannot set breakpoint on the specified IL offset.
   at Mono.Debugger.Soft.VirtualMachine.ErrorHandler(Object sender,
ErrorHandlerEventArgs args)
   at Mono.Debugger.Soft.Connection.SendReceive(CommandSet command_set, Int32
command, PacketWriter packet)
   at Mono.Debugger.Soft.Connection.EnableEvent(EventType etype, SuspendPolicy
suspend_policy, List`1 mods)
   at Mono.Debugger.Soft.EventRequest.SendReq(List`1 mods)
   at Mono.Debugger.Soft.BreakpointEventRequest.Enable()
   at Mono.Debugger.Soft.VirtualMachine.SetBreakpoint(MethodMirror method,
Int64 il_offset)
   at Mono.Debugging.Soft.SoftDebuggerSession.InsertBreakpoint(Breakpoint bp,
BreakInfo bi)
   at Mono.Debugging.Soft.SoftDebuggerSession.OnInsertBreakEvent(BreakEvent 
breakEvent)
   at Mono.Debugging.Client.DebuggerSession.AddBreakEvent(BreakEvent be)

This reportedly occurs in even blank applications created from template. The user indicates he has seen this behaviour in Xamarin.Forms projects and iOS projects.


## Version information

Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

LightSwitch for Visual Studio 2013 06177-004-0444002-02166
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013 06177-004-0444002-02166
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013 06177-004-0444002-02166
Microsoft Visual Basic 2013

Visual C# 2013 06177-004-0444002-02166
Microsoft Visual C# 2013

Visual C++ 2013 06177-004-0444002-02166
Microsoft Visual C++ 2013

Visual F# 2013 06177-004-0444002-02166
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker 06177-004-0444002-02166
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-0444002-02166
Windows Phone SDK 8.0 - ENU

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

ASP.NET<http://ASP.NET>; and Web Tools 12.4.51016.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET<http://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<http://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<http://ASP.NET>; web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET<http://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<http://ASP.NET>; Web Frameworks and Tools 2013 5.2.21010.0
For additional information, visit http://www.asp.net/

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

InstallShield Limited Edition
InstallShield. For more information visit the Flexera Software website at <http://www.FlexeraSoftware.com>;. Copyright © 2013 Flexera Software LLC. All Rights Reserved.

JetBrains ReSharper 8.2 Full Edition build 8.2.0.2160 on 2014-03-20T17:53:08
JetBrains ReSharper 8.2 package for Microsoft Visual Studio. For more information about ReSharper, visit http://www.jetbrains.com/resharper/. Copyright © 2003–2015 JetBrains, Inc.

Microsoft Azure Mobile Services Tools 1.3
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.3
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.41012.0
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.483.0 (978be3d)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android 4.20.0.37 (9e05e39f02bafe8fc0b7ab025d99f3b446835ad4)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS 8.8.0.0 (702be5207a1446b066f4653f68739da13c045227)
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 Jatin 2015-04-03 05:54:34 UTC
I have verified this issue with the latest builds, i.e. (XVS 3.11.271 + VS 2013 + Mono 4.0.0.121 + XI 8.10.0.197)

And have observed that with the trial license on the account, user is successfully able to apply breakpoint and on Debugging the application the breakpoint is getting hit.

Below is the screencast for the same:


Please try again with the latest builds as mentioned above, and if you still face the same issue, please revert back with the following information:

1. Screencast/Video demonstrating the issue.
2. Sample Project that giving the issue.
3. Or any other steps that will be required to replicate the issue.

Build information:
Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.50938

Installed Version: Professional

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

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

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

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

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

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

Visual Studio 2013 Code Analysis Spell Checker   06177-004-0446016-02538
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.

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

ASP.NET and Web Tools   12.4.51016.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.21010.0
For additional information, visit http://www.asp.net/

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

Microsoft Azure Mobile Services Tools   1.3
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.3
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.41012.0
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.11.271.0 (e36ba35)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   5.1.0.99 (e81edcfee3152b5892337b8741d8da28f9ee74b1)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.Forms Intellisense   1.0
Provides intellisense for Xamarin.Forms in the XML editor.

Xamarin.iOS   8.10.0.0 (3abf86b113ef9dd7c6aaf53c4c47bdb39ae526b9)
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 4 Jatin 2015-04-03 06:07:23 UTC
Screencast for the above comment #3
http://www.screencast.com/t/wMw5IN3Axj
Comment 5 till 2016-11-18 12:32:40 UTC
Getting the same Error in VS 2015 when hitting a breakpoint in an Android Project

Building with Android 6.0 


Microsoft Visual Studio Enterprise 2015
Version 14.0.25421.03 Update 3
Microsoft .NET Framework
Version 4.6.01055
Xamarin   4.2.1.60 (47830f6)
Xamarin.Android   7.0.2.37 (ce955cc)

Resolved pending breakpoint at 'C:\Git\Xyz2\Source\Xyz\Xyz.Android\Renderer\NativeControls\DrawView.cs:275,1' to void Xyz.Droid.Renderer.XyzButtonRenderer..ctor () [0x0006c].
11-18 13:08:40.230 W/        (18631): Unable to insert breakpoint at Xyz.Droid.Renderer.XyzButtonRenderer:.ctor ():108
Could not set breakpoint at location 'C:\Git\Xyz2\Source\Xyz\Xyz.Android\Renderer\NativeControls\DrawView.cs:275' (Cannot set breakpoint on the specified IL offset.)
Cannot set breakpoint on the specified IL offset.
Comment 6 Joaquin Jares 2017-01-13 11:44:54 UTC
There was an error where having the threads window open while debugging a non-forms android application will crash VS. That error is now fixed. I'm closing this bug for verification. Please reopen if that was not the issue.
Comment 7 mukeshkunder 2017-11-08 10:17:59 UTC
Getting the same Error in VS 2015 when hitting a breakpoint in an Xamarin PCL Project

Building with Android 5.0  & Above

Microsoft Visual Studio Enterprise 2015
Version 14.0.25421.03 Update 3
Microsoft .NET Framework
Version 4.6.01055
Xamarin   4.3.0.795 (aece090)
Xamarin.Android   7.1.0.43 (3a62f1e)
Xamarin.iOS   10.6.0.9 (a05f40e)

Issue : 

1) Resolved pending breakpoint at 'RestService.cs:84,1'

Cannot set breakpoint on the specified IL offset.
System.ArgumentException: Cannot set breakpoint on the specified IL offset.
   at Mono.Debugger.Soft.VirtualMachine.ErrorHandler(Object sender, ErrorHandlerEventArgs args)
   at Mono.Debugger.Soft.Connection.SendReceive(CommandSet command_set, Int32 command, PacketWriter packet)
   at Mono.Debugger.Soft.Connection.EnableEvent(EventType etype, SuspendPolicy suspend_policy, List`1 mods)
   at Mono.Debugger.Soft.EventRequest.SendReq(List`1 mods)
   at Mono.Debugger.Soft.BreakpointEventRequest.Enable()
   at Mono.Debugging.Soft.SoftDebuggerSession.InsertBreakpoint(Breakpoint bp, BreakInfo bi, MethodMirror method, Int32 ilOffset)
   at Mono.Debugging.Soft.SoftDebuggerSession.InsertBreakpoint(Breakpoint bp, BreakInfo bi)
   at Mono.Debugging.Soft.SoftDebuggerSession.ResolvePendingBreakpoint(BreakInfo bi, Location l)
   at Mono.Debugging.Soft.SoftDebuggerSession.ResolveBreakpoints(TypeMirror type)
   at Mono.Debugging.Soft.SoftDebuggerSession.HandleTypeLoadEvents(TypeLoadEvent[] events)
   at Mono.Debugging.Soft.SoftDebuggerSession.HandleEventSet(EventSet es)
   at Mono.Debugging.Soft.SoftDebuggerSession.EventHandler()
Thread finished: <Thread Pool> #9
11-08 15:21:47.956 D/Mono    ( 1242): [0xb9f4b960] worker finishing
Thread finished: <Thread Pool> #8
11-08 15:21:52.528 D/Mono    ( 1242): [0xb967c900] worker finishing
Thread finished: <Thread Pool> #2
Thread finished: <Thread Pool> #3
11-08 15:22:08.896 D/Mono    ( 1242): [0xb964ffc0] worker finishing
The thread 'Unknown' (0x9) has exited with code 0 (0x0).
The thread 'Unknown' (0x8) has exited with code 0 (0x0).
The thread 'Unknown' (0x2) has exited with code 0 (0x0).
The thread 'Unknown' (0x3) has exited with code 0 (0x0).

2) BreakPoints not getting hit only on Xamarin Forms Pages, but its getting hit in MainActivity.cs & App.xaml.cs
Comment 8 DiogoLeao 2017-11-24 18:27:02 UTC
Getting the same Error in an android project, My service start an Thread, when add a breakpoint inside this thread the message appears:

EXCEPTION:
System.ArgumentException: Cannot breakpoint on the specifide IL offset.
at Mono.Debugger.Soft.VirtualMachine.ErrorHandler(Object sender, ErrorHandlerEventArgs args)
at Mono.Debugger.Soft.Connect.SendReceive(CommandSet command_set, Int32 command, PacketWriter packet)
at Mono.Debugger.Soft.Connection.EnableEvent(EventType etype, SuspendPolicy suspend_policy, List`1 mods)
at Mono.Debugger.Soft.EventRequest.SendReq(List`1 mods)
at Mono.Debugger.Soft.BreakpointEventRequest.Enable()
at Mono.Debugger.Soft.SoftDebuggerSession.InsertBreakpoint(Breakpoint bp, BreakInfo bi, MethodMirror method, Int32 ilOffset)
at Mono.Debugging.Soft.SoftDebuggerSession.OnIsertBrealEvent(BreakEvent breakEvent)
at Mono.Debugging.Client.DebuggerSession.AddBreakEvent(BreakEvent be)

Microsoft Visual Studio Professional 2017 
Version 15.4.4
VisualStudio.15.Release/15.4.4+27004.2009
Microsoft .NET Framework
Version 4.7.02046

Microsoft JVM Debugger   1.0
Microsoft MI-Based Debugger   1.0
Mono Debugging for Visual Studio   4.7.4-pre (c2d89eb)
Visual Studio Code Debug Adapter Host Package   1.0
Xamarin   4.7.10.38 (34c1b6c)
Xamarin.Android SDK   8.0.2.1 (HEAD/c2a33d8ea)
Xamarin.iOS and Xamarin.Mac SDK   11.3.0.47 (51128b8)
Comment 9 DiogoLeao 2018-03-14 18:12:13 UTC
Problem solved running with:

Microsoft Visual Studio Professional 2017 
Version 15.6.2
VisualStudio.15.Release/15.6.2+27428.2005
Microsoft .NET Framework
Version 4.7.02556

Microsoft JVM Debugger   1.0
Microsoft MI-Based Debugger   1.0

Mono Debugging for Visual Studio   4.9.11-pre (71eb098)
Visual Studio Code Debug Adapter Host Package   1.0
Xamarin   4.9.0.749 (9b0fce36d)
Xamarin Designer   4.10.58 (cee1369d0)
Xamarin.Android SDK   8.2.0.15 (HEAD/22d97e153)
Xamarin.iOS and Xamarin.Mac SDK   11.8.0.20 (1c6f300)