Bug 57483 - Breakpoints not working when using unsafe switch
Summary: Breakpoints not working when using unsafe switch
Status: VERIFIED DUPLICATE of bug 56808
Alias: None
Product: iOS
Classification: Xamarin
Component: Debugger ()
Version: XI 10.10 (d15-2)
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2017-06-14 11:45 UTC by support
Modified: 2017-07-04 01:18 UTC (History)
6 users (show)

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 or GitHub 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 support 2017-06-14 11:45:18 UTC
Breakpoints not working when using unsafe switch.

Using VS2015 SP3 with up to date xamarin. Mac 10.12.4, XCode 8.3.2, up to date Xamarin. ipod 6 10.3.2

Steps to reproduce:

Create a new iOS project with Visual Studio 2015, in example, ios/Universal/OpenGL Game (iOS).
Put a breakpoint in the main function and run in ipod. Breakpoint hits.

Switch option "allow unsafe code" in the Build options. Clean and run. Breakpoint no longer hits. (it works in the simulator though)
Comment 1 Vincent Dondain [MSFT] 2017-06-14 22:29:37 UTC

I tried this in Visual Studio for Mac with the following environment: https://gist.github.com/VincentDondain/a84e7b2cc058b8b890c98752809a57e0 and couldn't reproduce.

I create a new iOS OpenGL template, set a breakpoint in the: `static void Main (string [] args)` function.

Allowed unsafe code for the project (Build > General > Allow 'unsafe' code).

Can someone on the team please try this on the windows side of the house?
Comment 2 Vincent Dondain [MSFT] 2017-06-14 22:30:25 UTC
Keeping bug as NEW
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2017-06-14 22:53:24 UTC
## Note to the Xamarin team

This appears to be another variation on the underlying issue from Bug 56808 where the Xamarin.iOS managed linking process fails to process the .mdb file because it exits unexpectedly when processing the "full" .pdb file.

In my local confirmation of the scenario described in Comment 0, like in Bug 56808:

- The .mdb file for the iOS app is present as expected in the "mtouch-cache/64/Link" directory, but it is _missing_ from the "mtouch-cache/64/PreBuild" directory and the final .app bundle.

- Changing the DebugType to "portable" for the app project (as described in duplicate Bug 56893, Comment 2) was effective as a workaround for this "Allow unsafe code" scenario too.

Based on these results, I will mark this bug as a duplicate of Bug 56808.  Once a candidate fix is available for Bug 56808, it would be good to double-check that the fix is also effective for this Bug 57483.

*** This bug has been marked as a duplicate of bug 56808 ***
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2017-07-04 01:18:18 UTC
## Verification status for the behavior described in Comment 0: verified fixed by the latest Xamarin.iOS "15.3 release" Beta channel preview for the remote Mac

GOOD: Xamarin.iOS (494fcbc)
BAD:  Xamarin.iOS  (104e7b4)

(In keeping with my usual verification procedure, I retested briefly on the "bad" version first to ensure I was still able to replicate the issue on an older version.)

## GOOD Results

The debugger _did_ pause on the breakpoint in `Main()` when "Allow unsafe code" was enabled.

## BAD Results

The debugger did _not_ pause on the breakpoint in `Main()` when "Allow unsafe code" was enabled.

## Additional testing environment info

### Windows

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

XamarinVS (60c3d0e)

Windows 10 version 1607 (OS Build 14393.0)
US English locale, US Eastern time zone

### Mac

Mono MDK (2017-04/478c04a)

Xcode 8.3, Build version 8E162
macOS 10.12.5
US English locale, US Eastern time zone

### Devices

iPad Mini 2, iOS 8.0