Bug 61091 - Xamarin.Forms: “Start debugging item” (iOS project) results in native crash (“Run item” works)
Summary: Xamarin.Forms: “Start debugging item” (iOS project) results in native crash (...
Status: VERIFIED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: 5.4 (2017-06)
Hardware: Macintosh Mac OS
: --- critical
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-12-13 17:33 UTC by Andres G. Aragoneses
Modified: 2018-02-15 16:09 UTC (History)
7 users (show)

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


Attachments
Minimal testcase solution (54.98 KB, application/zip)
2017-12-13 17:35 UTC, Andres G. Aragoneses
Details
Fixed project (77.42 KB, application/zip)
2018-01-02 13:51 UTC, Jason Imison
Details
Debugging screencast (1.04 MB, image/gif)
2018-01-25 10:43 UTC, Jason Imison
Details
Original app debugging (1.32 MB, image/gif)
2018-01-25 11:01 UTC, Jason Imison
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 on GitHub or 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:
VERIFIED FIXED

Description Andres G. Aragoneses 2017-12-13 17:33:14 UTC
# Steps to reproduce
1. Create XamForms solution from the F# template (PCL, default values).
2. Create .NET Standard backend library.
3. Transform the XamForms library from PCL into .NET Standard.
4. Make the XamForms library call the backend library.
5. Right click on the iOS project -> Start debugging item

# Expected behavior
Should run the app normally and present the “welcome to Xamarin forms” label (or Foo,Bar if using the test case I’m supplying).

# Actual behavior
App crashes, doesn't launch.

# Supplemental info (logs, images, videos)
The "Application Output" panel from VisualStudioForMac contains:

2017-12-14 01:17:19.316 GWallet.Frontend.XamForms.iOS[37985:11752354] error: * Assertion at /Users/builder/data/lanes/5665/6857dfcc/source/xamarin-macios/external/mono/mono/metadata/metadata.c:1116, condition `idx < t->rows' not met
2017-12-14 01:17:19.317 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: Stacktrace:

2017-12-14 01:17:19.317 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at <unknown> <0xffffffff>
2017-12-14 01:17:19.317 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at Microsoft.FSharp.Collections.IEnumerator/map@111<b_REF, a_REF>.DoMoveNext (b_REF&) [0x0000e] in /Users/builder/data/lanes/5665/6857dfcc/source/xamarin-macios/external/fsharp/src/fsharp/FSharp.Core/seq.fs:114
2017-12-14 01:17:19.317 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at Microsoft.FSharp.Collections.IEnumerator/MapEnumerator`1<T_REF>.System-Collections-IEnumerator-MoveNext () [0x0000c] in /Users/builder/data/lanes/5665/6857dfcc/source/xamarin-macios/external/fsharp/src/fsharp/FSharp.Core/seq.fs:100
2017-12-14 01:17:19.317 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at string.Join<T_REF> (string,System.Collections.Generic.IEnumerable`1<T_REF>) [0x0001f] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.2/src/mono/mcs/class/referencesource/mscorlib/system/string.cs:132
2017-12-14 01:17:19.317 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at Some.Backend.Say.Something () [0x00000] in /Users/andres/Documents/Code/debugXamarinIosBugMinimalTestcase/src/GWallet.Backend.NetStandard/SomeFSharpCode.fs:7
2017-12-14 01:17:19.317 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at Some.Frontend.XamForms.App.OnStart () [0x00012] in /Users/andres/Documents/Code/debugXamarinIosBugMinimalTestcase/src/GWallet.Frontend.XF/App.xaml.fs:13
2017-12-14 01:17:19.318 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at Xamarin.Forms.Application.SendStart () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Application.cs:236
2017-12-14 01:17:19.318 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.FinishedLaunching (UIKit.UIApplication,Foundation.NSDictionary) [0x0002e] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\FormsApplicationDelegate.cs:46
2017-12-14 01:17:19.318 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at GWalletFrontendXamForms.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication,Foundation.NSDictionary) [0x00011] in /Users/andres/Documents/Code/debugXamarinIosBugMinimalTestcase/src/GWallet.Frontend.XamForms.iOS/AppDelegate.fs:16
2017-12-14 01:17:19.318 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at (wrapper runtime-invoke) <Module>.runtime_invoke_bool__this___object_object (object,intptr,intptr,intptr) [0x00063] in <5a316095ac02f680a74503839560315a>:0
2017-12-14 01:17:19.318 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at <unknown> <0xffffffff>
2017-12-14 01:17:19.318 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) [0x0005c] in <e9ea199ae7c04df1b1527be56b61ef6d>:0
2017-12-14 01:17:19.318 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Users/builder/data/lanes/5665/6857dfcc/source/xamarin-macios/src/UIKit/UIApplication.cs:79
2017-12-14 01:17:19.318 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at UIKit.UIApplication.Main (string[],string,string) [0x00038] in /Users/builder/data/lanes/5665/6857dfcc/source/xamarin-macios/src/UIKit/UIApplication.cs:63
2017-12-14 01:17:19.318 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at GWalletFrontendXamForms.iOS.Main.main (string[]) [0x00000] in /Users/andres/Documents/Code/debugXamarinIosBugMinimalTestcase/src/GWallet.Frontend.XamForms.iOS/AppDelegate.fs:21
2017-12-14 01:17:19.319 GWallet.Frontend.XamForms.iOS[37985:11752354] critical:   at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) [0x00057] in <5a316095ac02f680a74503839560315a>:0
2017-12-14 01:17:19.319 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 
Native stacktrace:

2017-12-14 01:17:19.329 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	0   GWallet.Frontend.XamForms.iOS       0x000000010e447874 mono_handle_native_crash + 244
2017-12-14 01:17:19.329 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	1   libsystem_platform.dylib            0x000000011d4a5f5a _sigtramp + 26
2017-12-14 01:17:19.329 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	2   ???                                 0x0000ffff00001fa3 0x0 + 281470681751459
2017-12-14 01:17:19.329 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	3   libsystem_c.dylib                   0x000000011d06a0eb abort + 127
2017-12-14 01:17:19.329 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	4   GWallet.Frontend.XamForms.iOS       0x000000010e610b00 _ZL12log_callbackPKcS0_S0_iPv + 64
2017-12-14 01:17:19.329 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	5   GWallet.Frontend.XamForms.iOS       0x000000010e2e8053 monoeg_g_logv + 83
2017-12-14 01:17:19.329 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	6   GWallet.Frontend.XamForms.iOS       0x000000010e2e82ff monoeg_assertion_message + 143
2017-12-14 01:17:19.330 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	7   GWallet.Frontend.XamForms.iOS       0x000000010e4fc6d9 mono_metadata_decode_row + 217
2017-12-14 01:17:19.330 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	8   GWallet.Frontend.XamForms.iOS       0x000000010e4a75cb mono_ppdb_get_seq_points + 235
2017-12-14 01:17:19.330 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	9   GWallet.Frontend.XamForms.iOS       0x000000010e3de635 mono_method_to_ir + 1109
2017-12-14 01:17:19.330 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	10  GWallet.Frontend.XamForms.iOS       0x000000010e46245d mini_method_compile + 2877
2017-12-14 01:17:19.330 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	11  GWallet.Frontend.XamForms.iOS       0x000000010e465679 mono_jit_compile_method_inner + 761
2017-12-14 01:17:19.330 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	12  GWallet.Frontend.XamForms.iOS       0x000000010e454d23 mono_jit_compile_method_with_opt + 1347
2017-12-14 01:17:19.330 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	13  GWallet.Frontend.XamForms.iOS       0x000000010e45b47b common_call_trampoline + 1227
2017-12-14 01:17:19.330 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	14  GWallet.Frontend.XamForms.iOS       0x000000010e45c24f mono_vcall_trampoline + 207
2017-12-14 01:17:19.330 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	15  ???                                 0x000000013820851e 0x0 + 5236622622
2017-12-14 01:17:19.330 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	16  ???                                 0x000000013cd7beef 0x0 + 5315739375
2017-12-14 01:17:19.330 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	17  ???                                 0x000000013cd6e7e3 0x0 + 5315684323
2017-12-14 01:17:19.330 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	18  ???                                 0x000000013c4e9e03 0x0 + 5306752515
2017-12-14 01:17:19.331 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	19  GWallet.Frontend.XamForms.iOS       0x000000010e458929 mono_jit_runtime_invoke + 1273
2017-12-14 01:17:19.331 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	20  GWallet.Frontend.XamForms.iOS       0x000000010e5181d8 do_runtime_invoke + 88
2017-12-14 01:17:19.331 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	21  GWallet.Frontend.XamForms.iOS       0x000000010e518150 mono_runtime_invoke + 208
2017-12-14 01:17:19.331 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	22  GWallet.Frontend.XamForms.iOS       0x000000010e61954c xamarin_invoke_trampoline + 5996
2017-12-14 01:17:19.331 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	23  GWallet.Frontend.XamForms.iOS       0x000000010e6213dd xamarin_arch_trampoline + 189
2017-12-14 01:17:19.331 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	24  GWallet.Frontend.XamForms.iOS       0x000000010e622871 xamarin_x86_64_common_trampoline + 110
2017-12-14 01:17:19.331 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	25  UIKit                               0x0000000113f13bca -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 299
2017-12-14 01:17:19.332 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	26  UIKit                               0x0000000113f15648 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4113
2017-12-14 01:17:19.332 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	27  UIKit                               0x0000000113f1aaeb -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720
2017-12-14 01:17:19.332 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	28  UIKit                               0x00000001142e46f8 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924
2017-12-14 01:17:19.332 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	29  UIKit                               0x00000001146ba4c8 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
2017-12-14 01:17:19.332 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	30  UIKit                               0x00000001142e42f1 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249
2017-12-14 01:17:19.332 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	31  UIKit                               0x00000001142e4b6b -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 696
2017-12-14 01:17:19.332 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	32  UIKit                               0x0000000114c62a69 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262
2017-12-14 01:17:19.332 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	33  UIKit                               0x0000000114c62922 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444
2017-12-14 01:17:19.333 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	34  UIKit                               0x000000011493f9c8 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
2017-12-14 01:17:19.333 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	35  UIKit                               0x0000000114b3eb06 _performActionsWithDelayForTransitionContext + 100
2017-12-14 01:17:19.333 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	36  UIKit                               0x000000011493f88b -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231
2017-12-14 01:17:19.333 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	37  UIKit                               0x00000001146b9b25 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
2017-12-14 01:17:19.333 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	38  UIKit                               0x0000000113f1936a -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523
2017-12-14 01:17:19.333 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	39  UIKit                               0x00000001144f4605 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369
2017-12-14 01:17:19.333 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	40  FrontBoardServices                  0x000000012174ecc0 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338
2017-12-14 01:17:19.334 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	41  FrontBoardServices                  0x00000001217577b5 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235
2017-12-14 01:17:19.334 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	42  libdispatch.dylib                   0x000000011cf231ba _dispatch_client_callout + 8
2017-12-14 01:17:19.334 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	43  libdispatch.dylib                   0x000000011cf28468 _dispatch_block_invoke_direct + 324
2017-12-14 01:17:19.334 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	44  FrontBoardServices                  0x0000000121783498 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
2017-12-14 01:17:19.334 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	45  FrontBoardServices                  0x000000012178314e -[FBSSerialQueue _performNext] + 464
2017-12-14 01:17:19.336 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	46  FrontBoardServices                  0x00000001217836bd -[FBSSerialQueue _performNextFromRunLoopSource] + 45
2017-12-14 01:17:19.336 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	47  CoreFoundation                      0x000000010eca2101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
2017-12-14 01:17:19.336 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	48  CoreFoundation                      0x000000010ed41f71 __CFRunLoopDoSource0 + 81
2017-12-14 01:17:19.336 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	49  CoreFoundation                      0x000000010ec86a19 __CFRunLoopDoSources0 + 185
2017-12-14 01:17:19.336 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	50  CoreFoundation                      0x000000010ec85fff __CFRunLoopRun + 1279
2017-12-14 01:17:19.337 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	51  CoreFoundation                      0x000000010ec85889 CFRunLoopRunSpecific + 409
2017-12-14 01:17:19.337 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	52  GraphicsServices                    0x000000011fe1c9c6 GSEventRunModal + 62
2017-12-14 01:17:19.337 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	53  UIKit                               0x0000000113f1c5d6 UIApplicationMain + 159
2017-12-14 01:17:19.337 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	54  ???                                 0x000000013c4794a8 0x0 + 5306291368
2017-12-14 01:17:19.337 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 	55  ???                                 0x000000013c4790e3 0x0 + 5306290403
2017-12-14 01:17:19.337 GWallet.Frontend.XamForms.iOS[37985:11752354] critical: 
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================


# Test environment (full version information)
Using VisualStudioForMac 7.3 build 799 along with Xamarin.Forms 2.5.0121934
Comment 1 Andres G. Aragoneses 2017-12-13 17:35:16 UTC
Created attachment 25994 [details]
Minimal testcase solution

Minimal testcase
Comment 2 Andres G. Aragoneses 2017-12-13 17:37:29 UTC
Given that the backtrace points to /Users/builder/data/lanes/5665/6857dfcc/source/xamarin-macios/external/mono/mono/metadata/metadata.c:1116 I'm reassigning this bug to mono runtime.
Comment 3 Andres G. Aragoneses 2017-12-13 17:39:52 UTC
VS4Mac says 'Mono 5.4.1.7 (2017-06/e66d9abbb27) (64-bit)' in the About dialog.
Comment 4 asp_net 2017-12-22 10:58:39 UTC
JFYI: I just wanted to migrate an existing solution from PCL to .NET Standard (for the 3rd time this year ...) and eventually ran into the same situation.
Comment 5 Jason Imison 2017-12-22 11:08:24 UTC

*** This bug has been marked as a duplicate of bug 60467 ***
Comment 6 Jason Imison 2017-12-22 11:09:00 UTC
Please see workaround - https://bugzilla.xamarin.com/show_bug.cgi?id=60467#c1
Comment 7 Andres G. Aragoneses 2017-12-26 11:43:40 UTC
Hey Jason,

> Please see workaround

Thanks, but I've tested this workaround and it doesn't work for me. (I've added those properties in all the projects of my solution.)

Are you sure this is the same bug as that one? The stack trace we have in this one is a runtime assertion, but the stack trace in bug 60467 is a crash in the managed world. Happy holidays BTW!
Comment 8 Jason Imison 2017-12-28 10:33:26 UTC
Hi Andres,

I realised why the workaround doesn't work... Microsoft.Net.SDK projects bypass the Mono targets completely and use targets provided by the SDK.

This issue should be reported at the VisualFSharp repo.

In the meantime, I'll try and see if I can come up with some other workaround that will allow you to use the .mdb debugging format - the stack trace comes from an assertion in Mono that indicates that the pdb file isn't correct.
Comment 9 Jason Imison 2017-12-30 11:32:16 UTC
Andres, no - it's not the same bug, but both issues are caused by the use of portable pdb files generated by the F# compiler and then being ran/debugged using Mono. 

I assume that the coreclr runtime doesn't have the same assert that Mono has (which has been there for around 10 years or so! https://github.com/mono/mono/blame/e5246d94ab9907e66e76c1a5baa9240ea3fe52f5/mono/metadata/metadata.c#L1117)
Comment 10 Jason Imison 2018-01-02 13:51:56 UTC
Created attachment 26059 [details]
Fixed project

Andres,

I have a workaround, but it's pretty ugly and should be treated as a temporary solution only.

If you add the following lines to _every_ project

```
    <FscDebugType>full</FscDebugType>
    <FscDebugFileExt>.mdb</FscDebugFileExt>
    <FscToolExe>fsc.exe</FscToolExe>
    <FscToolPath>/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/fsharp</FscToolPath>
```

then the Mono version of the F# compiler is used and .mdb files will be generated instead of pdb files.. make sure to clean your solution first (or just delete any .pdb files)

I've attached your solution with my changes - you should be able to debug the iOS project.
Comment 11 Jason Imison 2018-01-22 12:10:17 UTC
With this patch [1] we don't get the crash, and it prints out some debug information. The error is in the F# compiler though and needs to be fied there.

[1] https://gist.github.com/lambdageek/1e5f8904daa2493093b825b32144d472#file-0001-Print-some-info-if-we-are-asked-to-look-up-a-method--patch
Comment 12 Jason Imison 2018-01-22 14:01:16 UTC
OK... I think I just realised what the root cause of this issue is. The F# compiler that is shipped with the Microsoft.Net.SDK is too old and is missing a crucial fix - https://github.com/Microsoft/visualfsharp/commit/38f489a75d812604079cbc5f9fe73f6e3f766e08
Comment 13 Jason Imison 2018-01-22 14:17:27 UTC
OK, 

Adding this to the .netstandard2.0 project is enough to get things working for now :-

```
<PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <FscToolExe>fsc.exe</FscToolExe>
    <FscToolPath>/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/fsharp</FscToolPath>
</PropertyGroup>
```

This leaves portable pdb debugging intact, but a newer version of the compiler is used for building.

I've emailed the F# guys to ask about getting an updated compiler.
Comment 14 asp_net 2018-01-22 17:45:59 UTC
Jason,

Thank you very much! I will give it a try soon.

Thomas
Comment 15 Andres G. Aragoneses 2018-01-24 09:23:53 UTC
> Adding this to the .netstandard2.0 project is enough to get things working for now 

Hey Jason! I confirm that adding this <PropertyGroup> makes the app not crash when clicking on "Start debugging item", however, breakpoints are not hit, so it's the same workaround as clicking "Run item" instead of debugging it ;)
Comment 16 Jason Imison 2018-01-25 10:43:42 UTC
Created attachment 26118 [details]
Debugging screencast

Hi Andres - It does work - check out the screencast - try rebuilding.
Comment 17 Jason Imison 2018-01-25 11:01:07 UTC
Created attachment 26119 [details]
Original app debugging

Screencast of me debugging the original application with the workaround
Comment 18 Andres G. Aragoneses 2018-01-25 11:11:24 UTC
Oh you're right! I don't know why it wasn't working for me at first. Thanksss
Comment 19 Jason Imison 2018-01-25 16:14:00 UTC
Glad it's working for you!
Comment 20 Andres G. Aragoneses 2018-02-11 16:25:53 UTC
Ludovic, why did you change this to RESOLVED? The last comments' were referring to a workaround. New users of Xamarin+F# would still get this crash.
Comment 21 Ludovic Henry 2018-02-11 17:59:28 UTC
My understanding is that the issue is with fsharp, which is not something we control, so the workaround is the best we can propose for now. Am I mistaken in that conclusion? Please feel free to reopen. Thank you
Comment 22 asp_net 2018-02-11 18:07:13 UTC
Wait a second: Visual Studio offers Xamarin templates for C# *and* F#. Whatever your internals are – as a customer I expect them to work. You can't be serious about closing this.
Comment 23 Jason Imison 2018-02-11 19:30:21 UTC
The issue isn't with fsharp/fsharp but the version of the compiler that ships with the .Net SDK. This is an upstream issue.

Also, please note that the issue does not manifest if you do not use a netstandard backend as part of your Xamarin Forms project. This is not part of the template.
Comment 24 asp_net 2018-02-11 20:03:34 UTC
> The issue isn't with fsharp/fsharp but the version of the compiler that ships with the .Net SDK. This is an upstream issue.

Is it reported/going to be fixed? Is there a specific issue I can subscribe to (on GitHub or somewhere else)?

> Also, please note that the issue does not manifest if you do not use a netstandard backend as part of your Xamarin Forms project. This is not part of the template.

Right. But that's hardly a strong argument as .NET Standard is becoming the de facto standard.
Comment 25 Andres G. Aragoneses 2018-02-12 02:33:16 UTC
Jason wrote:
> The issue isn't with fsharp/fsharp but the version of the compiler that ships with 
> the .Net SDK. This is an upstream issue.

Ludovic, see above ^

Being an upstream issue doesn't mean that VisualStudio for Mac doesn't have a bug. As long as VisualStudio for Mac doesn't ship with an up to date compiler version that doesn't have this bug, there's a not RESOLVED bug here, hence this should be reopened until that happens.
Comment 26 Jason Imison 2018-02-12 09:41:21 UTC
> Right. But that's hardly a strong argument as .NET Standard is becoming the de facto standard.

.NET Standard will be part of the template as soon as there are no known issues :)

> As long as VisualStudio for Mac doesn't ship with an up to date compiler version that doesn't have this bug

We don't ship the .NET SDK compiler. Hence the bug :) We ship the fsharp/fsharp compiler which we compile ourselves.

Happy to reopen, but there is nothing here to do except wait for an update to the .NET SDK compiler which will happen automatically in a future update.
Comment 27 Andres G. Aragoneses 2018-02-12 09:54:18 UTC
> but there is nothing here to do except wait for an update to the .NET SDK compiler which will happen automatically in a future update.

When that update happens, this can be closed, and the CCed people in this bug can remove the workarounds from their repositories safely ;-) Otherwise we don't know when to remove the workarounds :)
Comment 28 Jason Imison 2018-02-12 20:17:44 UTC
I can debug the original app without modifications provided that I have the latest stable SDK. (Downloaded from here https://www.microsoft.com/net/download/macos tested with 2.1.4). 

```
20:12 $ dotnet --version
2.1.4
✔ ~
```
Comment 29 Andres G. Aragoneses 2018-02-15 16:09:15 UTC
My VS4Mac has received the update to 2.1.4, and it works. Thanks!